Methods and apparatuses for encoding and decoding motion vector difference using sequence mmvd information

ABSTRACT

Provided is a video decoding method including: obtaining, from a sequence parameter set, sequence merge mode with motion vector difference (sequence MMVD) information indicating whether an MMVD mode is applicable in a current sequence; when the MMVD mode is applicable according to the sequence MMVD information, obtaining, from a bitstream, first MMVD information indicating whether the MMVD mode is applied in a first inter prediction mode for a current block included in the current sequence; when the MMVD mode is applicable in the first inter prediction mode according to the first MMVD information, reconstructing a motion vector of the current block which is to be used in the first inter prediction mode, by using a distance of a motion vector difference and a direction of a motion vector difference obtained from the bitstream; and reconstructing the current block by using the motion vector of the current block.

CROSS-REFERENCE TO RELATED APPLICATIONS

This is a Continuation application of U.S. application Ser. No.17/419,127 filed Jun. 28, 2021, which is a National Stage ofInternational Application No. PCT/KR2019/018738 filed Dec. 30, 2019,which claims benefit of U.S. Provisional No. 62/792,266 filed on Jan.14, 2019 in the United States Patent and Trademark Office and whichclaims benefit of 62/785,742 filed on Dec. 28, 2018 in the United StatesPatent and Trademark Office. The disclosures of which are incorporatedherein by reference in their entireties.

TECHNICAL FIELD

The disclosure relates to the fields of image encoding and decoding. Inparticular, the disclosure relates to a method and apparatus forencoding a motion vector used to encode and decode an image and a methodand apparatus for decoding the motion vector.

BACKGROUND ART

In methods of encoding and decoding an image, one picture may be splitinto blocks to encode the image and each block may be prediction encodedvia inter prediction or intra prediction.

A representative example of inter prediction is motion estimationencoding using a method of compressing an image by removing temporalredundancy between pictures. In motion estimation encoding, blocks of acurrent picture are predicted by using at least one reference picture. Areference block most similar to a current block may be searched for in apredetermined search range by using a predetermined evaluation function.The current block is predicted based on the reference block, and aresidual block is generated by subtracting a prediction block generatedas a result of the prediction from the current block and then encoded.In this regard, to further accurately perform the prediction,interpolation is performed on a search range of reference pictures so asto generate pixels of sub pel units smaller than integer pel units andinter prediction may be performed based on the generated pixels of subpel units.

In the standard such as H.264 advanced video coding (AVC) and highefficiency video coding (HEVC), a motion vector of pre-encoded blocksadjacent to a current block or blocks included in a pre-encoded pictureis used as a prediction motion vector of the current block so as topredict a motion vector of the current block. A differential motionvector that is a difference between the motion vector of the currentblock and the prediction motion vector is signaled to a decoder via apredetermined method.

DESCRIPTION OF EMBODIMENTS Technical Problem

An encoding method and encoding apparatus with respect to a motionvector difference and a decoding method and decoding apparatus withrespect to the motion vector difference, according to an embodiment,efficiently encode and decode the motion vector difference used invarious tools applied to an inter mode.

Solution to Problem

A video decoding method according to an embodiment of the disclosure mayinclude: obtaining, from a sequence parameter set, sequence merge modewith motion vector difference (sequence MMVD) information indicatingwhether an MMVD mode is applicable in a current sequence; when the MMVDmode is applicable according to the sequence MMVD information,obtaining, from a bitstream, first MMVD information indicating whetherthe MMVD mode is applied in a first inter prediction mode for a currentblock included in the current sequence; when the MMVD mode is applicablein the first inter prediction mode according to the first MMVDinformation, reconstructing a motion vector of the current block whichis to be used in the first inter prediction mode, by using a distance ofa motion vector difference and a direction of the motion vectordifference obtained from the bitstream; and reconstructing the currentblock by Using the Motion Vector of the Current Block.

ADVANTAGEOUS EFFECTS OF DISCLOSURE

According to an embodiment, provided are an encoding method and encodingapparatus with respect to a motion vector difference and a decodingmethod and decoding apparatus with respect to a motion informationdifference, which determine whether to use a motion vector difference inhigh-level syntax at a level of every sequence, picture, or block unitso as to efficiently encode the motion vector difference used in varioustools applied to an inter mode.

However, effects achievable by methods of encoding and decoding motioninformation and apparatuses for encoding and decoding motioninformation, according to an embodiment, are not limited to thosementioned above, and other unstated effects will be clearly understoodby one of ordinary skill in the art in view of descriptions below.

BRIEF DESCRIPTION OF DRAWINGS

A brief description of each drawing is provided for better understandingof the drawings cited herein.

FIG. 1 is a schematic block diagram of an image decoding apparatusaccording to an embodiment.

FIG. 2 is a flowchart of an image decoding method according to anembodiment.

FIG. 3 illustrates a process, performed by an image decoding apparatus,of determining at least one coding unit by splitting a current codingunit, according to an embodiment.

FIG. 4 illustrates a process, performed by an image decoding apparatus,of determining at least one coding unit by splitting a non-square codingunit, according to an embodiment.

FIG. 5 illustrates a process, performed by an image decoding apparatus,of splitting a coding unit based on at least one of block shapeinformation and split shape mode information, according to anembodiment.

FIG. 6 illustrates a method, performed by an image decoding apparatus,of determining a predetermined coding unit from among an odd number ofcoding units, according to an embodiment.

FIG. 7 illustrates an order of processing a plurality of coding unitswhen an image decoding apparatus determines the plurality of codingunits by splitting a current coding unit, according to an embodiment.

FIG. 8 illustrates a process, performed by an image decoding apparatus,of determining that a current coding unit is to be split into an oddnumber of coding units, when the coding units are not processable in apredetermined order, according to an embodiment.

FIG. 9 illustrates a process, performed by an image decoding apparatus,of determining at least one coding unit by splitting a first codingunit, according to an embodiment.

FIG. 10 illustrates that a shape into which a second coding unit issplittable is restricted when the second coding unit of a non-squareshape, which is determined when an image decoding apparatus splits afirst coding unit, satisfies a predetermined condition, according to anembodiment.

FIG. 11 illustrates a process, performed by an image decoding apparatus,of splitting a square coding unit when split shape mode information isunable to indicate that the square coding unit is split into four squarecoding units, according to an embodiment.

FIG. 12 illustrates that a processing order between a plurality ofcoding units may be changed depending on a process of splitting a codingunit, according to an embodiment.

FIG. 13 illustrates a process of determining a depth of a coding unitwhen a shape and size of the coding unit change, when the coding unit isrecursively split such that a plurality of coding units are determined,according to an embodiment.

FIG. 14 illustrates depths that are determinable based on shapes andsizes of coding units, and part indices (PIDs) that are fordistinguishing between the coding units, according to an embodiment.

FIG. 15 illustrates that a plurality of coding units are determinedbased on a plurality of predetermined data units included in a picture,according to an embodiment.

FIG. 16 is a block diagram of an image encoding and decoding system.

FIG. 17 is a detailed block diagram of a video decoding apparatusaccording to an embodiment.

FIG. 18 is a flowchart of a video decoding method according to anembodiment.

FIG. 19 is a block diagram of a video encoding apparatus according to anembodiment.

FIG. 20 is a flowchart of a video encoding method according to anembodiment.

FIG. 21 illustrates locations of motion vector candidates, according toan embodiment.

FIG. 22 is a diagram showing motion vector candidates displayed on acoordinate plane.

FIG. 23 illustrates values and meanings of a merge index, distanceindices of a merge difference, and direction indices of the mergedifference, according to an embodiment.

FIG. 24 illustrates equations for obtaining a motion vector by using abase motion vector and a merge motion vector difference, according to anembodiment.

FIG. 25 illustrates equations for adjusting precision of a motion vectorpredictor or a base motion vector when precision of a distance index ofa merge difference is 64 according to an embodiment.

FIG. 26 illustrates equations for adjusting precision of a motion vectorpredictor or a base motion vector when precision of a distance index ofa merge difference is 16 according to an embodiment.

FIG. 27 illustrates reference table for determining binarization of aplurality of pieces of merge-related information according to anembodiment.

FIG. 28 illustrates comparison table of bin strings of 8 distanceindices of a merge difference according to various binarizations.

FIG. 29 illustrates an embodiment of k-th order exp-golomb binarization.

FIG. 30 illustrates comparison table of a bin string of 6 distanceindices of a merge difference according to various binarizations.

FIG. 31 illustrates bin strings that are generated by varyingbinarization according to groups of distance indices of a mergedifference according to an embodiment.

FIG. 32 illustrates codewords of cases of 8 distance indices of a mergedifference indices according to an embodiment.

FIG. 33 illustrates codewords of cases of 6 distance indices of a mergedifference according to an embodiment.

FIG. 34 illustrates triangular partitions that are available in atriangular partition prediction mode according to an embodiment.

FIG. 35 illustrates a prediction block determined by using triangularpartitions in a triangular partition prediction mode according to anembodiment.

FIG. 36 illustrates a flowchart of a video decoding method according toanother embodiment.

FIG. 37 illustrates a flowchart of a video encoding method according toanother embodiment.

BEST MODE

A video decoding method according to an embodiment of the disclosure mayinclude: obtaining, from a sequence parameter set, sequence merge modewith motion vector difference (sequence MMVD) information indicatingwhether an MMVD mode is applicable in a current sequence; when the MMVDmode is applicable according to the sequence MMVD information,obtaining, from a bitstream, first MMVD information indicating whetherthe MMVD mode is applied in a first inter prediction mode for a currentblock included in the current sequence; when the MMVD mode is applicablein the first inter prediction mode according to the first MMVDinformation, reconstructing a motion vector of the current block whichis to be used in the first inter prediction mode, by using a distance ofa motion vector difference and a direction of the motion vectordifference obtained from the bitstream; and reconstructing the currentblock by using the motion vector of the current block.

According to an embodiment, the obtaining of, from the bitstream, thefirst MMVD information may include: when the MMVD mode is applicableaccording to the sequence MMVD information, obtaining sub-pixel MMVDinformation indicating whether a motion vector difference in an integerpixel unit is used or a motion vector difference in a sub-pixel unit isused in the current sequence; and when the MMVD mode is applicableaccording to the sequence MMVD information, obtaining MMVD informationindicating whether the MMVD mode is used for the current block includedin the current sequence, and the reconstructing of the motion vector ofthe current block may include: when the MMVD mode is used for thecurrent block according to the MMVD information, reconstructing,according to the sub-pixel MMVD information, a distance of a motionvector difference in an integer pixel unit or a sub-pixel unit from adistance index of the motion vector difference of the current blockobtained from the bitstream; and determining the motion vector of thecurrent block by using the distance of the motion vector difference.

According to an embodiment, the reconstructing of the distance of themotion vector difference in the integer pixel unit or the sub-pixel unitfrom the distance index of the motion vector difference of the currentblock may include: when the MMVD mode is used for the current blockaccording to the MMVD information and the motion vector difference inthe integer pixel unit is used according to the sub-pixel MMVDinformation, reconstructing the distance of the motion vector differencein the integer pixel unit from the distance index of the motion vectordifference of the current block obtained from the bitstream; and whenthe MMVD mode is used for the current block according to the MMVDinformation and the motion vector difference in the sub-pixel unit isused according to the sub-pixel MMVD information, reconstructing thedistance of the motion vector difference in the sub-pixel unit from thedistance index of the motion vector difference of the current blockobtained from the bitstream.

According to an embodiment, the reconstructing of the motion vector ofthe current block may include: obtaining, from the bitstream,information indicating a base motion vector of the current block and adirection index of a motion vector difference of the current block;determining a motion vector difference of the current block by using adistance index of the motion vector difference of the current block andthe direction index of the motion vector difference; determining thebase motion vector of the current block by using the informationindicating the base motion vector of the current block; and determiningthe motion vector of the current block by using the base motion vectorand the motion vector difference of the current block.

According to an embodiment, when the MMVD mode is not applicable in thecurrent sequence according to the sequence MMVD information, both themotion vector difference in the integer pixel unit and the motion vectordifference in the sub-pixel unit may not be usable in the currentsequence and the current block.

According to an embodiment, the determining of the motion vector of thecurrent block may include: when the reconstructed distance of the motionvector difference is in the integer pixel unit, rounding an x componentvalue and a y component value of the base motion vector of the currentblock to the integer pixel unit, and reconstructing the motion vector inthe integer pixel unit by using the x component value and the ycomponent value of the base motion vector which are rounded to theinteger pixel unit; and when the reconstructed distance of the motionvector difference is in the sub-pixel unit, reconstructing a motionvector in the sub-pixel unit by using the distance of the motion vectordifference in the sub-pixel unit, and an x component value and a ycomponent value of the base motion vector which are rounded to thesub-pixel unit.

According to an embodiment of the disclosure, a video decoding apparatusmay include: a syntax element obtainer configured to obtain, from asequence parameter set, sequence merge mode with motion vectordifference (sequence MMVD) information indicating whether an MMVD modeis applicable in a current sequence, and when the MMVD mode isapplicable according to the sequence MMVD information, obtain, from abitstream, first MMVD information indicating whether the MMVD mode isapplied in a first inter prediction mode for a current block included inthe current sequence; and a decoder configured to, when the MMVD mode isapplicable in the first inter prediction mode according to the firstMMVD information, reconstruct a motion vector of the current block whichis to be used in the first inter prediction mode, by using a distance ofa motion vector difference and a direction of the motion vectordifference obtained from the bitstream, and reconstruct the currentblock by using the motion vector of the current block.

According to an embodiment, the syntax element obtainer may beconfigured to, when the MMVD mode is applicable according to thesequence MMVD information, obtain sub-pixel MMVD information indicatingwhether a motion vector difference in an integer pixel unit is used or amotion vector difference in a sub-pixel unit is used in the currentsequence, and when the MMVD mode is applicable according to the sequenceMMVD information, obtain MMVD information indicating whether the MMVDmode is used for the current block included in the current sequence, andthe decoder may be configured to, when the MMVD mode is used for thecurrent block according to the MMVD information, reconstruct, accordingto the sub-pixel MMVD information, a distance of a motion vectordifference in an integer pixel unit or a sub-pixel unit from a distanceindex of the motion vector difference of the current block obtained fromthe bitstream, and determine the motion vector of the current block byusing the distance of the motion vector difference.

According to an embodiment of the disclosure, a video encoding methodmay include: encoding sequence merge mode with motion vector difference(sequence MMVD) information indicating whether an MMVD mode isapplicable in a current sequence; when the MMVD mode is applicable inthe current sequence, encoding first MMVD information indicating whetherthe MMVD mode is used for a current block included in the currentsequence in a first inter prediction mode; and when the MMVD mode isapplied in the first inter prediction mode, encoding a distance index ofa motion vector difference and a direction index of the motion vectordifference of the current block.

According to an embodiment, the video encoding method may furtherinclude: when the MMVD mode is applicable in the current sequence,encoding sub-pixel MMVD information indicating whether a motion vectordifference in an integer pixel unit is used or a motion vectordifference in a sub-pixel unit is used in the current sequence; and whenthe MMVD mode is applicable, encoding MMVD information indicatingwhether the MMVD mode is used for the current block included in thecurrent sequence, and the encoding of the distance index of the motionvector difference and the direction index of the motion vectordifference of the current block may include, when the MMVD mode is usedfor the current block, encoding the distance index of the motion vectordifference of the current block which is determined according to adistance of a motion vector difference in an integer pixel unit or asub-pixel unit.

According to an embodiment, the encoding of the distance index of themotion vector difference of the current block may include: when the MMVDmode is used for the current block and the motion vector difference inthe integer pixel unit is used, determining the distance index of themotion vector difference of the current block based on the motion vectordifference in the integer pixel unit; and when the MMVD mode is used forthe current block and the motion vector difference in the sub-pixel unitis used, determining the distance index of the motion vector differenceof the current block based on the motion vector difference in thesub-pixel unit.

The encoding of the distance index of the motion vector difference ofthe current block may include: when the distance of the motion vectordifference is encoded in an integer pixel unit, rounding an x componentvalue and a y component value of a base motion vector of the currentblock to the integer pixel unit, determining the distance of the motionvector difference in the integer pixel unit by using the x componentvalue and the y component value of the base motion vector which arerounded to the integer pixel unit, and encoding a distance indexcorresponding to the distance of the motion vector difference in theinteger pixel unit; and when the motion vector differential distance isencoded in a sub-pixel unit, rounding an x component value and a ycomponent value of the base motion vector of the current block to thesub-pixel unit, determining the distance of the motion vector differencein the sub-pixel unit by using the x component value and the y componentvalue of the base motion vector which are rounded to the sub-pixel unit,and encoding a distance index corresponding to the distance of themotion vector difference in the sub-pixel unit.

According to an embodiment of the disclosure, a video decoding methodmay include: obtaining, from a bitstream, sequence merge mode withmotion vector difference (sequence MMVD) information indicating whethera triangular partition prediction mode is enabled for a current block;obtaining, from the bitstream, second information indicating whether anintra/inter combination prediction mode is enabled for the currentblock; when the triangular partition prediction mode is enabled for thecurrent block according to the sequence MMVD information, determiningwhether to apply the triangular partition prediction mode to the currentblock, based on a size and a width of the current block; and when thetriangular partition prediction mode is enabled for the current blockaccording to the sequence MMVD information and the intra/intercombination prediction mode is enabled for the current block accordingto the second information, determining whether to apply the intra/intercombination prediction mode to the current block, based on the size andthe width of the current block.

According to an embodiment, the determining of whether to apply thetriangular partition prediction mode to the current block, based on thesize and the width of the current block, may include, whenmultiplication of the size and the width of the current block is smallerthan 64, the size of the current block is greater than a maximum size ofa coding unit, or the width of the current block is greater than themaximum size of the coding unit, determining that it is unavailable toapply the triangular partition prediction mode to the current block.

According to an embodiment, the determining of whether to apply theintra/inter combination prediction mode to the current block, based onthe size and the width of the current block may include, whenmultiplication of the size and the width of the current block is smallerthan 64, the size of the current block is greater than a maximum size ofa coding unit, or the width of the current block is greater than themaximum size of the coding unit, determining that it is unavailable toapply the intra/inter combination prediction mode to the current block.

According to an embodiment of the disclosure, provided is acomputer-readable recording medium having recorded thereon a program forimplementing the video decoding method on a computer.

According to an embodiment of the disclosure, provided is acomputer-readable recording medium having recorded thereon a program forimplementing the video encoding method on a computer.

MODE OF DISCLOSURE

As the disclosure allows for various changes and numerous embodiments,particular embodiments will be illustrated in the drawings and describedin detail in the written descriptions. However, this is not intended tolimit the disclosure to particular modes of practice, and it will beunderstood that all changes, equivalents, and substitutes that do notdepart from the spirit and technical scope of various embodiments areencompassed in the disclosure.

In the description of embodiments, detailed explanations of related artare omitted when it is deemed that they may unnecessarily obscure theessence of the disclosure. Also, numbers (for example, a first, asecond, and the like) used in the descriptions of the specification aremerely identifier codes for distinguishing one element from another.

Also, in the present specification, it will be understood that whenelements are “connected” or “coupled” to each other, the elements may bedirectly connected or coupled to each other, but may alternatively beconnected or coupled to each other with an intervening elementtherebetween, unless specified otherwise.

In the present specification, regarding an element represented as a“unit” or a “module”, two or more elements may be combined into oneelement or one element may be divided into two or more elementsaccording to subdivided functions. In addition, each element describedhereinafter may additionally perform some or all of functions performedby another element, in addition to main functions of itself, and some ofthe main functions of each element may be performed entirely by anothercomponent.

Also, in the present specification, an ‘image’ or a ‘picture’ may denotea still image of a video or a moving image, i.e., the video itself.

Also, in the present specification, a ‘sample’ denotes data assigned toa sampling position of an image, i.e., data to be processed. Forexample, pixel values of an image in a spatial domain and transformcoefficients on a transform region may be samples. A unit including atleast one such sample may be defined as a block.

Also, in the present specification, a ‘current block’ may denote a blockof a largest coding unit, coding unit, prediction unit, or transformunit of a current image to be encoded or decoded.

In the present specification, a motion vector in a direction of a list 0may denote a motion vector used to indicate a block in a referencepicture included in the list 0, and a motion vector in a direction of alist 1 may denote a motion vector used to indicate a block in areference picture included in the list 1. Also, a motion vector in aunidirection may denote a motion vector used to indicate a block in areference picture included in the list 0 or list 1, and a motion vectorin a bidirection may denote that the motion vector includes a motionvector in a direction of the list 0 and a motion vector in a directionof the list 1.

Hereinafter, an image encoding apparatus and an image decodingapparatus, and an image encoding method and an image decoding methodaccording to embodiments will be described with reference to FIGS. 1 to16 . A method of determining a data unit of an image, according to anembodiment, will be described with reference to FIGS. 3 to 16 , and avideo encoding/decoding method using a merge mode with motion vectordifference (MMVD) will be described with reference to FIGS. 17 to 37 .

Hereinafter, with reference to FIGS. 1 and 2 , a method and apparatusfor adaptive selection based on coding units of various shapes accordingto an embodiment of the disclosure will be described.

FIG. 1 is a schematic block diagram of an image decoding apparatusaccording to an embodiment.

An image decoding apparatus 100 may include a receiver 110 and a decoder120. The receiver 110 and the decoder 120 may include at least oneprocessor. Also, the receiver 110 and the decoder 120 may include amemory storing instructions to be performed by the at least oneprocessor.

The receiver 110 may receive a bitstream. The bitstream includesinformation of an image encoded by an image encoding apparatus 2200 tobe described below. Also, the bitstream may be transmitted from theimage encoding apparatus 2200. The image encoding apparatus 2200 and theimage decoding apparatus 100 may be connected by wire or wirelessly, andthe receiver 110 may receive the bitstream by wire or wirelessly. Thereceiver 110 may receive the bitstream from a storage medium, such as anoptical medium or a hard disk. The decoder 120 may reconstruct an imagebased on information obtained from the received bitstream. The decoder120 may obtain, from the bitstream, a syntax element for reconstructingthe image. The decoder 120 may reconstruct the image based on the syntaxelement.

Operations of the image decoding apparatus 100 will be described indetail with reference to FIG. 2 .

FIG. 2 is a flowchart of an image decoding method according to anembodiment.

According to an embodiment of the disclosure, the receiver 110 receivesa bitstream.

The image decoding apparatus 100 obtains, from a bitstream, a bin stringcorresponding to a split shape mode of a coding unit (operation 210).The image decoding apparatus 100 determines a split rule of the codingunit (operation 220). Also, the image decoding apparatus 100 splits thecoding unit into a plurality of coding units, based on at least one ofthe bin string corresponding to the split shape mode and the split rule(operation 230). The image decoding apparatus 100 may determine anallowable first range of a size of the coding unit, according to a ratioof the width and the height of the coding unit, so as to determine thesplit rule. The image decoding apparatus 100 may determine an allowablesecond range of the size of the coding unit, according to the splitshape mode of the coding unit, so as to determine the split rule.

Hereinafter, splitting of a coding unit will be described in detailaccording to an embodiment of the disclosure.

First, one picture may be split into one or more slices or one or moretiles. One slice or one tile may be a sequence of one or more largestcoding units (coding tree units (CTUs)). There is a largest coding block(coding tree block (CTB)) conceptually compared to a largest coding unit(CTU).

The largest coding block (CTB) denotes an N×N block including N×Nsamples (where N is an integer). Each color component may be split intoone or more largest coding blocks.

When a picture has three sample arrays (sample arrays for Y, Cr, and Cbcomponents), a largest coding unit (CTU) includes a largest coding blockof a luma sample, two corresponding largest coding blocks of chromasamples, and syntax structures used to encode the luma sample and thechroma samples. When a picture is a monochrome picture, a largest codingunit includes a largest coding block of a monochrome sample and syntaxstructures used to encode the monochrome samples. When a picture is apicture encoded in color planes separated according to color components,a largest coding unit includes syntax structures used to encode thepicture and samples of the picture.

One largest coding block (CTB) may be split into M×N coding blocksincluding M×N samples (M and N are integers).

When a picture has sample arrays for Y, Cr, and Cb components, a codingunit (CU) includes a coding block of a luma sample, two correspondingcoding blocks of chroma samples, and syntax structures used to encodethe luma sample and the chroma samples. When a picture is a monochromepicture, a coding unit includes a coding block of a monochrome sampleand syntax structures used to encode the monochrome samples. When apicture is a picture encoded in color planes separated according tocolor components, a coding unit includes syntax structures used toencode the picture and samples of the picture.

As described above, a largest coding block and a largest coding unit areconceptually distinguished from each other, and a coding block and acoding unit are conceptually distinguished from each other. That is, a(largest) coding unit refers to a data structure including a (largest)coding block including a corresponding sample and a syntax structurecorresponding to the (largest) coding block. However, because it isunderstood by one of ordinary skill in the art that a (largest) codingunit or a (largest) coding block refers to a block of a predeterminedsize including a predetermined number of samples, a largest coding blockand a largest coding unit, or a coding block and a coding unit arementioned in the following specification without being distinguishedunless otherwise described.

An image may be split into largest coding units (CTUs). A size of eachlargest coding unit may be determined based on information obtained froma bitstream. A shape of each largest coding unit may be a square shapeof the same size. However, the embodiment is not limited thereto.

For example, information about a maximum size of a luma coding block maybe obtained from a bitstream. For example, the maximum size of the lumacoding block indicated by the information about the maximum size of theluma coding block may be one of 4×4, 8×8, 16×16, 32×32, 64×64, 128×128,and 256×256.

For example, information about a luma block size difference and amaximum size of a luma coding block that may be split into two may beobtained from a bitstream. The information about the luma block sizedifference may refer to a size difference between a luma largest codingunit and a largest luma coding block that may be split into two.Accordingly, when the information about the maximum size of the lumacoding block that may be split into two and the information about theluma block size difference obtained from the bitstream are combined witheach other, a size of the luma largest coding unit may be determined. Asize of a chroma largest coding unit may be determined by using the sizeof the luma largest coding unit. For example, when a Y:Cb:Cr ratio is4:2:0 according to a color format, a size of a chroma block may be halfa size of a luma block, and a size of a chroma largest coding unit maybe half a size of a luma largest coding unit.

According to an embodiment, because information about a maximum size ofa luma coding block that is binary splittable is obtained from abitstream, the maximum size of the luma coding block that is binarysplittable may be variably determined. In contrast, a maximum size of aluma coding block that is ternary splittable may be fixed. For example,the maximum size of the luma coding block that is ternary splittable inan I-picture may be 32×32, and the maximum size of the luma coding blockthat is ternary splittable in a P-picture or aB-picture may be 64×64.

Also, a largest coding unit may be hierarchically split into codingunits based on split shape mode information obtained from a bitstream.At least one of information indicating whether quad splitting isperformed, information indicating whether multi-splitting is performed,split direction information, and split type information may be obtainedas the split shape mode information from the bitstream.

For example, the information indicating whether quad splitting isperformed may indicate whether a current coding unit is quad split(QUAD_SPLIT) or not.

When the current coding unit is not quad split, the informationindicating whether multi-splitting is performed may indicate whether thecurrent coding unit is no longer split (NO_SPLIT) or binary/ternarysplit.

When the current coding unit is binary split or ternary split, the splitdirection information indicates that the current coding unit is split inone of a horizontal direction and a vertical direction.

When the current coding unit is split in the horizontal direction or thevertical direction, the split type information indicates that thecurrent coding unit is binary split or ternary split.

A split mode of the current coding unit may be determined according tothe split direction information and the split type information. A splitmode when the current coding unit is binary split in the horizontaldirection may be determined to be a binary horizontal split mode(SPLIT_BT_HOR), a split mode when the current coding unit is ternarysplit in the horizontal direction may be determined to be a ternaryhorizontal split mode (SPLIT_TT_HOR), a split mode when the currentcoding unit is binary split in the vertical direction may be determinedto be a binary vertical split mode (SPLIT_BT_VER), and a split mode whenthe current coding unit is ternary split in the vertical direction maybe determined to be a ternary vertical split mode (SPLIT_TT_VER).

The image decoding apparatus 100 may obtain, from the bitstream, thesplit shape mode information from one bin string. A form of thebitstream received by the image decoding apparatus 100 may include fixedlength binary code, unary code, truncated unary code, predeterminedbinary code, or the like. The bin string is information in a binarynumber. The bin string may include at least one bit. The image decodingapparatus 100 may obtain the split shape mode information correspondingto the bin string, based on the split rule. The image decoding apparatus100 may determine whether to quad split a coding unit, whether not tosplit a coding unit, a split direction, and a split type, based on onebin string.

The coding unit may be smaller than or the same as the largest codingunit. For example, because a largest coding unit is a coding unit havinga maximum size, the largest coding unit is one of coding units. Whensplit shape mode information about a largest coding unit indicates thatsplitting is not performed, a coding unit determined in the largestcoding unit has the same size as that of the largest coding unit. Whensplit shape mode information about a largest coding unit indicates thatsplitting is performed, the largest coding unit may be split into codingunits. Also, when split shape mode information about a coding unitindicates that splitting is performed, the coding unit may be split intosmaller coding units. However, the splitting of the image is not limitedthereto, and the largest coding unit and the coding unit may not bedistinguished. The splitting of the coding unit will be described indetail with reference to FIGS. 3 to 16 .

Also, one or more prediction blocks for prediction may be determinedfrom a coding unit. The prediction block may be the same as or smallerthan the coding unit. Also, one or more transform blocks fortransformation may be determined from a coding unit. The transform blockmay be equal to or smaller than the coding unit.

The shapes and sizes of the transform block and prediction block may notbe related to each other.

In another embodiment, prediction may be performed by using a codingunit as a prediction unit. Also, transformation may be performed byusing a coding unit as a transform block.

The splitting of the coding unit will be described in detail withreference to FIGS. 3 to 16 . A current block and an adjacent block ofthe disclosure may indicate one of the largest coding unit, the codingunit, the prediction block, and the transform block. Also, the currentblock of the current coding unit is a block that is currently beingdecoded or encoded or a block that is currently being split. Theadjacent block may be a block reconstructed before the current block.The adjacent block may be adjacent to the current block spatially ortemporally. The adjacent block may be located at one of the lower left,left, upper left, top, upper right, right, lower right of the currentblock.

FIG. 3 illustrates a process, performed by an image decoding apparatus,of determining at least one coding unit by splitting a current codingunit, according to an embodiment.

A block shape may include 4N×4N, 4N×2N, 2N×4N, 4N×N, N×4N, 32N×N, N×32N,16N×N, N×16N, 8N×N, or N×8N. Here, N may be a positive integer. Blockshape information is information indicating at least one of a shape, adirection, a ratio of width and height, or size of a coding unit.

The shape of the coding unit may include a square and a non-square. Whenthe lengths of the width and height of the coding unit are the same(i.e., when the block shape of the coding unit is 4N×4N), the imagedecoding apparatus 100 may determine the block shape information of thecoding unit as a square. The image decoding apparatus 100 may determinethe shape of the coding unit to be a non-square.

When the width and the height of the coding unit are different from eachother (i.e., when the block shape of the coding unit is 4N×2N, 2N×4N,4N×N, N×4N, 32N×N, N×32N, 16N×N, N×16N, 8N×N, or N×8N), the imagedecoding apparatus 100 may determine the block shape information of thecoding unit as a non-square shape. When the shape of the coding unit isnon-square, the image decoding apparatus 100 may determine the ratio ofthe width and height among the block shape information of the codingunit to be at least one of 1:2, 2:1, 1:4, 4:1, 1:8, 8:1, 1:16, 16:1,1:32, and 32:1. Also, the image decoding apparatus 100 may determinewhether the coding unit is in a horizontal direction or a verticaldirection, based on the length of the width and the length of the heightof the coding unit. Also, the image decoding apparatus 100 may determinethe size of the coding unit, based on at least one of the length of thewidth, the length of the height, or the area of the coding unit.

According to an embodiment, the image decoding apparatus 100 maydetermine the shape of the coding unit by using the block shapeinformation, and may determine a splitting method of the coding unit byusing the split shape mode information. That is, a coding unit splittingmethod indicated by the split shape mode information may be determinedbased on a block shape indicated by the block shape information used bythe image decoding apparatus 100.

The image decoding apparatus 100 may obtain the split shape modeinformation from a bitstream. However, an embodiment is not limitedthereto, and the image decoding apparatus 100 and the image encodingapparatus 2200 may determine pre-agreed split shape mode information,based on the block shape information. The image decoding apparatus 100may determine the pre-agreed split shape mode information with respectto a largest coding unit or a minimum coding unit. For example, theimage decoding apparatus 100 may determine split shape mode informationwith respect to the largest coding unit to be a quad split. Also, theimage decoding apparatus 100 may determine split shape mode informationregarding the smallest coding unit to be “not to perform splitting”. Inparticular, the image decoding apparatus 100 may determine the size ofthe largest coding unit to be 256×256. The image decoding apparatus 100may determine the pre-agreed split shape mode information to be a quadsplit. The quad split is a split shape mode in which the width and theheight of the coding unit are both bisected. The image decodingapparatus 100 may obtain a coding unit of a 128×128 size from thelargest coding unit of a 256×256 size, based on the split shape modeinformation. Also, the image decoding apparatus 100 may determine thesize of the smallest coding unit to be 4×4. The image decoding apparatus100 may obtain split shape mode information indicating “not to performsplitting” with respect to the smallest coding unit.

According to an embodiment, the image decoding apparatus 100 may use theblock shape information indicating that the current coding unit has asquare shape. For example, the image decoding apparatus 100 maydetermine whether not to split a square coding unit, whether tovertically split the square coding unit, whether to horizontally splitthe square coding unit, or whether to split the square coding unit intofour coding units, based on the split shape mode information. Referringto FIG. 3 , when the block shape information of a current coding unit300 indicates a square shape, the decoder 120 may not split a codingunit 310 a having the same size as the current coding unit 300, based onthe split shape mode information indicating not to perform splitting, ormay determine coding units 310 b, 310 c, 310 d, 310 e, or 310 f splitbased on the split shape mode information indicating a predeterminedsplitting method.

Referring to FIG. 3 , according to an embodiment, the image decodingapparatus 100 may determine two coding units 310 b obtained by splittingthe current coding unit 300 in a vertical direction, based on the splitshape mode information indicating to perform splitting in a verticaldirection. The image decoding apparatus 100 may determine two codingunits 310 c obtained by splitting the current coding unit 300 in ahorizontal direction, based on the split shape mode informationindicating to perform splitting in a horizontal direction. The imagedecoding apparatus 100 may determine four coding units 310 d obtained bysplitting the current coding unit 300 in vertical and horizontaldirections, based on the split shape mode information indicating toperform splitting in vertical and horizontal directions. According to anembodiment, the image decoding apparatus 100 may determine three codingunits 310 e obtained by splitting the current coding unit 300 in avertical direction, based on the split shape mode information indicatingto perform ternary splitting in a vertical direction. The image decodingapparatus 100 may determine three coding units 310 f obtained bysplitting the current coding unit 300 in a horizontal direction, basedon the split shape mode information indicating to perform ternarysplitting in a horizontal direction. However, splitting methods of thesquare coding unit are not limited to the above-described methods, andthe split shape mode information may indicate various methods.Predetermined splitting methods of splitting the square coding unit willbe described in detail below in relation to various embodiments.

FIG. 4 illustrates a process, performed by an image decoding apparatus,of determining at least one coding unit by splitting a non-square codingunit, according to an embodiment.

According to an embodiment, the image decoding apparatus 100 may useblock shape information indicating that a current coding unit has anon-square shape. The image decoding apparatus 100 may determine whethernot to split the non-square current coding unit or whether to split thenon-square current coding unit by using a predetermined splittingmethod, based on split shape mode information. Referring to FIG. 4 ,when the block shape information of a current coding unit 400 or 450indicates a non-square shape, the image decoding apparatus 100 maydetermine a coding unit 410 or 460 having the same size as the currentcoding unit 400 or 450, based on the split shape mode informationindicating not to perform splitting, or may determine coding units 420 aand 420 b, 430 a to 430 c, 470 a and 470 b, or 480 a to 480 c splitbased on the split shape mode information indicating a predeterminedsplitting method. Predetermined splitting methods of splitting anon-square coding unit will be described in detail below in relation tovarious embodiments.

According to an embodiment, the image decoding apparatus 100 maydetermine a splitting method of a coding unit by using the split shapemode information and, in this case, the split shape mode information mayindicate the number of one or more coding units generated by splitting acoding unit. Referring to FIG. 4 , when the split shape mode informationindicates to split the current coding unit 400 or 450 into two codingunits, the image decoding apparatus 100 may determine two coding units420 a and 420 b, or 470 a and 470 b included in the current coding unit400 or 450, by splitting the current coding unit 400 or 450 based on thesplit shape mode information.

According to an embodiment, when the image decoding apparatus 100 splitsthe non-square current coding unit 400 or 450 based on the split shapemode information, the image decoding apparatus 100 may consider thelocation of a long side of the non-square current coding unit 400 or 450to split a current coding unit. For example, the image decodingapparatus 100 may determine a plurality of coding units by splitting thecurrent coding unit 400 or 450 in a direction of splitting a long sideof the current coding unit 400 or 450, in consideration of the shape ofthe current coding unit 400 or 450.

According to an embodiment, when the split shape mode informationindicates to split (ternary split) a coding unit into an odd number ofblocks, the image decoding apparatus 100 may determine an odd number ofcoding units included in the current coding unit 400 or 450. Forexample, when the split shape mode information indicates to split thecurrent coding unit 400 or 450 into three coding units, the imagedecoding apparatus 100 may split the current coding unit 400 or 450 intothree coding units 430 a, 430 b, and 430 c, or 480 a, 480 b, and 480 c.

According to an embodiment, a ratio of the width and height of thecurrent coding unit 400 or 450 may be 4:1 or 1:4. When the ratio of thewidth and height is 4:1, the block shape information may indicate ahorizontal direction because the length of the width is longer than thelength of the height. When the ratio of the width and height is 1:4, theblock shape information may indicate a vertical direction because thelength of the width is shorter than the length of the height. The imagedecoding apparatus 100 may determine to split a current coding unit intoan odd number of blocks, based on the split shape mode information.Also, the image decoding apparatus 100 may determine a split directionof the current coding unit 400 or 450, based on the block shapeinformation of the current coding unit 400 or 450. For example, when thecurrent coding unit 400 is in the vertical direction, the image decodingapparatus 100 may determine the coding units 430 a, 430 b, and 430 c bysplitting the current coding unit 400 in the horizontal direction. Also,when the current coding unit 450 is in the horizontal direction, theimage decoding apparatus 100 may determine the coding units 480 a, 480b, and 480 c by splitting the current coding unit 450 in the verticaldirection.

According to an embodiment, the image decoding apparatus 100 maydetermine an odd number of coding units included in the current codingunit 400 or 450, and not all the determined coding units may have thesame size. For example, a predetermined coding unit 430 b or 480 b fromamong the determined odd number of coding units 430 a, 430 b, and 430 c,or 480 a, 480 b, and 480 c may have a size different from the size ofthe other coding units 430 a and 430 c, or 480 a and 480 c. That is,coding units which may be determined by splitting the current codingunit 400 or 450 may have multiple sizes and, in some cases, all of theodd number of coding units 430 a, 430 b, and 430 c, or 480 a, 480 b, and480 c may have different sizes.

According to an embodiment, when the split shape mode informationindicates to split a coding unit into the odd number of blocks, theimage decoding apparatus 100 may determine the odd number of codingunits included in the current coding unit 400 or 450, and moreover, mayput a predetermined restriction on at least one coding unit from amongthe odd number of coding units generated by splitting the current codingunit 400 or 450. Referring to FIG. 4 , the image decoding apparatus 100may set a decoding process regarding the coding unit 430 b or 480 blocated at the center among the three coding units 430 a, 430 b, and 430c, or 480 a, 480 b, and 480 c generated as the current coding unit 400or 450 is split to be different from that of the other coding units 430a and 430 c, or 480 a and 480 c. For example, the image decodingapparatus 100 may restrict the coding unit 430 b or 480 b at the centerlocation to be no longer split or to be split only a predeterminednumber of times, unlike the other coding units 430 a and 430 c, or 480 aand 480 c.

FIG. 5 illustrates a process, performed by an image decoding apparatus,of splitting a coding unit based on at least one of block shapeinformation and split shape mode information, according to anembodiment.

According to an embodiment, the image decoding apparatus 100 maydetermine to split or to not split a square first coding unit 500 intocoding units, based on at least one of the block shape information andthe split shape mode information. According to an embodiment, when thesplit shape mode information indicates to split the first coding unit500 in a horizontal direction, the image decoding apparatus 100 maydetermine a second coding unit 510 by splitting the first coding unit500 in a horizontal direction. A first coding unit, a second codingunit, and a third coding unit used according to an embodiment are termsused to understand a relation before and after splitting a coding unit.For example, a second coding unit may be determined by splitting a firstcoding unit, and a third coding unit may be determined by splitting thesecond coding unit. It will be understood that the relation of the firstcoding unit, the second coding unit, and the third coding unit followsthe above descriptions.

According to an embodiment, the image decoding apparatus 100 maydetermine to split or to not split the determined second coding unit 510into coding units, based on the split shape mode information. Referringto FIG. 5 , the image decoding apparatus 100 may split the non-squaresecond coding unit 510, which is determined by splitting the firstcoding unit 500, into one or more third coding units 520 a, 520 b, 520c, and 520 d based on at least one of the split shape mode informationand the split shape mode information, or may not split the non-squaresecond coding unit 510. The image decoding apparatus 100 may obtain thesplit shape mode information, and may obtain a plurality ofvarious-shaped second coding units (e.g., 510) by splitting the firstcoding unit 500, based on the obtained split shape mode information, andthe second coding unit 510 may be split by using a splitting method ofthe first coding unit 500 based on the split shape mode information.According to an embodiment, when the first coding unit 500 is split intothe second coding units 510 based on the split shape mode information ofthe first coding unit 500, the second coding unit 510 may also be splitinto the third coding units (e.g., 520 a, or 520 b, 520 c, and 520 d)based on the split shape mode information of the second coding unit 510.That is, a coding unit may be recursively split based on the split shapemode information of each coding unit. Therefore, a square coding unitmay be determined by splitting a non-square coding unit, and anon-square coding unit may be determined by recursively splitting thesquare coding unit.

Referring to FIG. 5 , a predetermined coding unit (e.g., a coding unitlocated at a center location, or a square coding unit) from among an oddnumber of third coding units 520 b, 520 c, and 520 d determined bysplitting the non-square second coding unit 510 may be recursivelysplit. According to an embodiment, the square third coding unit 520 cfrom among the odd number of third coding units 520 b, 520 c, and 520 dmay be split in a horizontal direction into a plurality of fourth codingunits. A non-square fourth coding unit 530 b or 530 d from among theplurality of fourth coding units 530 a, 530 b, 530 c, and 530 d may bere-split into a plurality of coding units. For example, the non-squarefourth coding unit 530 b or 530 d may be re-split into an odd number ofcoding units. A method that may be used to recursively split a codingunit will be described below in relation to various embodiments.

According to an embodiment, the image decoding apparatus 100 may spliteach of the third coding units 520 a, or 520 b, 520 c, and 520 d intocoding units, based on the split shape mode information. Also, the imagedecoding apparatus 100 may determine to not split the second coding unit510 based on the split shape mode information. According to anembodiment, the image decoding apparatus 100 may split the non-squaresecond coding unit 510 into the odd number of third coding units 520 b,520 c, and 520 d. The image decoding apparatus 100 may put apredetermined restriction on a predetermined third coding unit fromamong the odd number of third coding units 520 b, 520 c, and 520 d. Forexample, the image decoding apparatus 100 may restrict the third codingunit 520 c at a center location from among the odd number of thirdcoding units 520 b, 520 c, and 520 d to be no longer split or to besplit a settable number of times.

Referring to FIG. 5 , the image decoding apparatus 100 may restrict thethird coding unit 520 c, which is at the center location from among theodd number of third coding units 520 b, 520 c, and 520 d included in thenon-square second coding unit 510, to be no longer split, to be split byusing a predetermined splitting method (e.g., split into only fourcoding units or split by using a splitting method of the second codingunit 510), or to be split only a predetermined number of times (e.g.,split only n times (where n>0)). However, the restrictions on the thirdcoding unit 520 c at the center location are not limited to theabove-described examples, and may include various restrictions fordecoding the third coding unit 520 c at the center location differentlyfrom the other third coding units 520 b and 520 d.

According to an embodiment, the image decoding apparatus 100 may obtainthe split shape mode information, which is used to split a currentcoding unit, from a predetermined location in the current coding unit.

FIG. 6 illustrates a method, performed by an image decoding apparatus,of determining a predetermined coding unit from among an odd number ofcoding units, according to an embodiment.

Referring to FIG. 6 , split shape mode information of a current codingunit 600 or 650 may be obtained from a sample of a predeterminedlocation (e.g., a sample 640 or 690 of a center location) from among aplurality of samples included in the current coding unit 600 or 650.However, the predetermined location in the current coding unit 600, fromwhich at least one piece of the split shape mode information may beobtained, is not limited to the center location in FIG. 6 , and mayinclude various locations included in the current coding unit 600 (e.g.,top, bottom, left, right, upper left, lower left, upper right, lowerright locations, or the like). The image decoding apparatus 100 mayobtain the split shape mode information from the predetermined locationand may determine to split or to not split the current coding unit intovarious-shaped and various-sized coding units.

According to an embodiment, when the current coding unit is split into apredetermined number of coding units, the image decoding apparatus 100may select one of the coding units. Various methods may be used toselect one of a plurality of coding units, as will be described below inrelation to various embodiments.

According to an embodiment, the image decoding apparatus 100 may splitthe current coding unit into a plurality of coding units, and maydetermine a coding unit at a predetermined location.

According to an embodiment, image decoding apparatus 100 may useinformation indicating locations of the odd number of coding units, todetermine a coding unit at a center location from among the odd numberof coding units. Referring to FIG. 6 , the image decoding apparatus 100may determine the odd number of coding units 620 a, 620 b, and 620 c orthe odd number of coding units 660 a, 660 b, and 660 c by splitting thecurrent coding unit 600 or the current coding unit 650. The imagedecoding apparatus 100 may determine the middle coding unit 620 b or themiddle coding unit 660 b by using information about the locations of theodd number of coding units 620 a, 620 b, and 620 c or the odd number ofcoding units 660 a, 660 b, and 660 c. For example, the image decodingapparatus 100 may determine the coding unit 620 b of the center locationby determining the locations of the coding units 620 a, 620 b, and 620 cbased on information indicating locations of predetermined samplesincluded in the coding units 620 a, 620 b, and 620 c. In detail, theimage decoding apparatus 100 may determine the coding unit 620 b at thecenter location by determining the locations of the coding units 620 a,620 b, and 620 c based on information indicating locations of upper-leftsamples 630 a, 630 b, and 630 c of the coding units 620 a, 620 b, and620 c.

According to an embodiment, the information indicating the locations ofthe upper-left samples 630 a, 630 b, and 630 c, which are included inthe coding units 620 a, 620 b, and 620 c, respectively, may includeinformation about locations or coordinates of the coding units 620 a,620 b, and 620 c in a picture. According to an embodiment, theinformation indicating the locations of the upper-left samples 630 a,630 b, and 630 c, which are included in the coding units 620 a, 620 b,and 620 c, respectively, may include information indicating widths orheights of the coding units 620 a, 620 b, and 620 c included in thecurrent coding unit 600, and the widths or heights may correspond toinformation indicating differences between the coordinates of the codingunits 620 a, 620 b, and 620 c in the picture. That is, the imagedecoding apparatus 100 may determine the coding unit 620 b at the centerlocation by directly using the information about the locations orcoordinates of the coding units 620 a, 620 b, and 620 c in the picture,or by using the information about the widths or heights of the codingunits, which correspond to the difference values between thecoordinates.

According to an embodiment, information indicating the location of theupper-left sample 630 a of the upper coding unit 620 a may includecoordinates (xa, ya), information indicating the location of theupper-left sample 630 b of the center coding unit 620 b may includecoordinates (xb, yb), and information indicating the location of theupper-left sample 630 c of the lower coding unit 620 c may includecoordinates (xc, yc). The image decoding apparatus 100 may determine themiddle coding unit 620 b by using the coordinates of the upper-leftsamples 630 a, 630 b, and 630 c which are included in the coding units620 a, 620 b, and 620 c, respectively. For example, when the coordinatesof the upper-left samples 630 a, 630 b, and 630 c are sorted in anascending or descending order, the coding unit 620 b including thecoordinates (xb, yb) of the sample 630 b at a center location may bedetermined as a coding unit at a center location from among the codingunits 620 a, 620 b, and 620 c determined by splitting the current codingunit 600. However, the coordinates indicating the locations of theupper-left samples 630 a, 630 b, and 630 c may include coordinatesindicating absolute locations in the picture, or may use coordinates(dxb, dyb) indicating a relative location of the upper-left sample 630 bof the middle coding unit 620 b and coordinates (dxc, dyc) indicating arelative location of the upper-left sample 630 c of the lower codingunit 620 c with reference to the location of the upper-left sample 630 aof the upper coding unit 620 a. A method of determining a coding unit ata predetermined location by using coordinates of a sample included inthe coding unit, as information indicating a location of the sample, isnot limited to the above-described method, and may include variousarithmetic methods capable of using the coordinates of the sample.

According to an embodiment, the image decoding apparatus 100 may splitthe current coding unit 600 into a plurality of coding units 620 a, 620b, and 620 c, and may select one of the coding units 620 a, 620 b, and620 c based on a predetermined criterion. For example, the imagedecoding apparatus 100 may select the coding unit 620 b, which has asize different from that of the others, from among the coding units 620a, 620 b, and 620 c.

According to an embodiment, the image decoding apparatus 100 maydetermine the width or height of each of the coding units 620 a, 620 b,and 620 c by using the coordinates (xa, ya) that is the informationindicating the location of the upper-left sample 630 a of the uppercoding unit 620 a, the coordinates (xb, yb) that is the informationindicating the location of the upper-left sample 630 b of the middlecoding unit 620 b, and the coordinates (xc, yc) that are the informationindicating the location of the upper-left sample 630 c of the lowercoding unit 620 c. The image decoding apparatus 100 may determine therespective sizes of the coding units 620 a, 620 b, and 620 c by usingthe coordinates (xa, ya), (xb, yb), and (xc, yc) indicating thelocations of the coding units 620 a, 620 b, and 620 c. According to anembodiment, the image decoding apparatus 100 may determine the width ofthe upper coding unit 620 a to be the width of the current coding unit600. The image decoding apparatus 100 may determine the height of theupper coding unit 620 a to be yb-ya. According to an embodiment, theimage decoding apparatus 100 may determine the width of the middlecoding unit 620 b to be the width of the current coding unit 600. Theimage decoding apparatus 100 may determine the height of the middlecoding unit 620 b to be yc-yb. According to an embodiment, the imagedecoding apparatus 100 may determine the width or height of the lowercoding unit 620 c by using the width or height of the current codingunit 600 or the widths or heights of the upper and middle coding units620 a and 620 b. The image decoding apparatus 100 may determine a codingunit, which has a size different from that of the others, based on thedetermined widths and heights of the coding units 620 a, 620 b, and 620c. Referring to FIG. 6 , the image decoding apparatus 100 may determinethe middle coding unit 620 b, which has a size different from the sizeof the upper and lower coding units 620 a and 620 c, as the coding unitof the predetermined location. However, the above-described method,performed by the image decoding apparatus 100, of determining a codingunit having a size different from the size of the other coding unitsmerely corresponds to an example of determining a coding unit at apredetermined location by using the sizes of coding units, which aredetermined based on coordinates of samples, and thus various methods ofdetermining a coding unit at a predetermined location by comparing thesizes of coding units, which are determined based on coordinates ofpredetermined samples, may be used.

The image decoding apparatus 100 may determine the width or height ofeach of the coding units 660 a, 660 b, and 660 c by using thecoordinates (xd, yd) that are information indicating the location of anupper-left sample 670 a of the left coding unit 660 a, the coordinates(xe, ye) that are information indicating the location of an upper-leftsample 670 b of the middle coding unit 660 b, and the coordinates (xf,yf) that are information indicating a location of the upper-left sample670 c of the right coding unit 660 c. The image decoding apparatus 100may determine the respective sizes of the coding units 660 a, 660 b, and660 c by using the coordinates (xd, yd), (xe, ye), and (xf, yf)indicating the locations of the coding units 660 a, 660 b, and 660 c.

According to an embodiment, the image decoding apparatus 100 maydetermine the width of the left coding unit 660 a to be xe-xd. The imagedecoding apparatus 100 may determine the height of the left coding unit660 a to be the height of the current coding unit 650. According to anembodiment, the image decoding apparatus 100 may determine the width ofthe middle coding unit 660 b to be xf-xe. The image decoding apparatus100 may determine the height of the middle coding unit 660 b to be theheight of the current coding unit 650. According to an embodiment, theimage decoding apparatus 100 may determine the width or height of theright coding unit 660 c by using the width or height of the currentcoding unit 650 or the widths or heights of the left and middle codingunits 660 a and 660 b. The image decoding apparatus 100 may determine acoding unit, which has a size different from that of the others, basedon the determined widths and heights of the coding units 660 a, 660 b,and 660 c. Referring to FIG. 6 , the image decoding apparatus 100 maydetermine the middle coding unit 660 b, which has a size different fromthe sizes of the left and right coding units 660 a and 660 c, as thecoding unit of the predetermined location. However, the above-describedmethod, performed by the image decoding apparatus 100, of determining acoding unit having a size different from the size of the other codingunits merely corresponds to an example of determining a coding unit at apredetermined location by using the sizes of coding units, which aredetermined based on coordinates of samples, and thus various methods ofdetermining a coding unit at a predetermined location by comparing thesizes of coding units, which are determined based on coordinates ofpredetermined samples, may be used.

However, locations of samples considered to determine locations ofcoding units are not limited to the above-described upper leftlocations, and information about arbitrary locations of samples includedin the coding units may be used.

According to an embodiment, the image decoding apparatus 100 may selecta coding unit at a predetermined location from among an odd number ofcoding units determined by splitting the current coding unit,considering the shape of the current coding unit. For example, when thecurrent coding unit has a non-square shape, a width of which is longerthan a height, the image decoding apparatus 100 may determine the codingunit at the predetermined location in a horizontal direction. That is,the image decoding apparatus 100 may determine one of coding units atdifferent locations in a horizontal direction and may put a restrictionon the coding unit. When the current coding unit has a non-square shape,a height of which is longer than a width, the image decoding apparatus100 may determine the coding unit at the predetermined location in avertical direction. That is, the image decoding apparatus 100 maydetermine one of coding units at different locations in a verticaldirection and may put a restriction on the coding unit.

According to an embodiment, the image decoding apparatus 100 may useinformation indicating respective locations of an even number of codingunits, to determine the coding unit at the predetermined location fromamong the even number of coding units. The image decoding apparatus 100may determine an even number of coding units by splitting (binarysplitting) the current coding unit, and may determine the coding unit atthe predetermined location by using the information about the locationsof the even number of coding units. An operation related thereto maycorrespond to the operation of determining a coding unit at apredetermined location (e.g., a center location) from among an oddnumber of coding units, which has been described in detail above inrelation to FIG. 6 , and thus detailed descriptions thereof are notprovided here.

According to an embodiment, when a non-square current coding unit issplit into a plurality of coding units, predetermined information abouta coding unit at a predetermined location may be used in a splittingoperation to determine the coding unit at the predetermined locationfrom among the plurality of coding units. For example, the imagedecoding apparatus 100 may use at least one of block shape informationand split shape mode information, which is stored in a sample includedin a middle coding unit, in a splitting operation to determine a codingunit at a center location from among the plurality of coding unitsdetermined by splitting the current coding unit.

Referring to FIG. 6 , the image decoding apparatus 100 may split thecurrent coding unit 600 into the plurality of coding units 620 a, 620 b,and 620 c based on the split shape mode information, and may determinethe coding unit 620 b at a center location from among the plurality ofthe coding units 620 a, 620 b, and 620 c. Furthermore, the imagedecoding apparatus 100 may determine the coding unit 620 b at the centerlocation, in consideration of a location from which the split shape modeinformation is obtained. That is, the split shape mode information ofthe current coding unit 600 may be obtained from the sample 640 at acenter location of the current coding unit 600 and, when the currentcoding unit 600 is split into the plurality of coding units 620 a, 620b, and 620 c based on the split shape mode information, the coding unit620 b including the sample 640 may be determined as the coding unit atthe center location. However, information used to determine the codingunit at the center location is not limited to the split shape modeinformation, and various types of information may be used to determinethe coding unit at the center location.

According to an embodiment, predetermined information for identifyingthe coding unit at the predetermined location may be obtained from apredetermined sample included in a coding unit to be determined.Referring to FIG. 6 , the image decoding apparatus 100 may use the splitshape mode information, which is obtained from a sample at apredetermined location in the current coding unit 600 (e.g., a sample ata center location of the current coding unit 600) to determine a codingunit at a predetermined location from among the plurality of the codingunits 620 a, 620 b, and 620 c determined by splitting the current codingunit 600 (e.g., a coding unit at a center location from among aplurality of split coding units). That is, the image decoding apparatus100 may determine the sample at the predetermined location byconsidering a block shape of the current coding unit 600, may determinethe coding unit 620 b including a sample, from which predeterminedinformation (e.g., the split shape mode information) can be obtained,from among the plurality of coding units 620 a, 620 b, and 620 cdetermined by splitting the current coding unit 600, and may put apredetermined restriction on the coding unit 620 b. Referring to FIG. 6, according to an embodiment, the image decoding apparatus 100 maydetermine the sample 640 at the center location of the current codingunit 600 as the sample from which the predetermined information may beobtained, and may put a predetermined restriction on the coding unit 620b including the sample 640, in a decoding operation. However, thelocation of the sample from which the predetermined information can beobtained is not limited to the above-described location, and may includearbitrary locations of samples included in the coding unit 620 b to bedetermined for a restriction.

According to an embodiment, the location of the sample from which thepredetermined information may be obtained may be determined based on theshape of the current coding unit 600. According to an embodiment, theblock shape information may indicate whether the current coding unit hasa square or non-square shape, and the location of the sample from whichthe predetermined information may be obtained may be determined based onthe shape. For example, the image decoding apparatus 100 may determine asample located on a boundary for splitting at least one of a width andheight of the current coding unit in half, as the sample from which thepredetermined information can be obtained, by using at least one ofinformation about the width of the current coding unit and informationabout the height of the current coding unit. As another example, whenthe block shape information of the current coding unit indicates anon-square shape, the image decoding apparatus 100 may determine one ofsamples including a boundary for splitting a long side of the currentcoding unit in half, as the sample from which the predeterminedinformation can be obtained.

According to an embodiment, when the current coding unit is split into aplurality of coding units, the image decoding apparatus 100 may use thesplit shape mode information to determine a coding unit at apredetermined location from among the plurality of coding units.According to an embodiment, the image decoding apparatus 100 may obtainthe split shape mode information from a sample at a predeterminedlocation in a coding unit, and may split the plurality of coding units,which are generated by splitting the current coding unit, by using thesplit shape mode information, which is obtained from the sample of thepredetermined location in each of the plurality of coding units. Thatis, a coding unit may be recursively split based on the split shape modeinformation, which is obtained from the sample at the predeterminedlocation in each coding unit. An operation of recursively splitting acoding unit has been described above in relation to FIG. 5 , and thusdetailed descriptions thereof will not be provided here.

According to an embodiment, the image decoding apparatus 100 maydetermine one or more coding units by splitting the current coding unit,and may determine an order of decoding the one or more coding units,based on a predetermined block (e.g., the current coding unit).

FIG. 7 illustrates an order of processing a plurality of coding unitswhen an image decoding apparatus determines the plurality of codingunits by splitting a current coding unit, according to an embodiment.

According to an embodiment, the image decoding apparatus 100 maydetermine second coding units 710 a and 710 b by splitting a firstcoding unit 700 in a vertical direction, may determine second codingunits 730 a and 730 b by splitting the first coding unit 700 in ahorizontal direction, or may determine second coding units 750 a, 750 b,750 c, and 750 d by splitting the first coding unit 700 in vertical andhorizontal directions, based on split shape mode information.

Referring to FIG. 7 , the image decoding apparatus 100 may determine toprocess the second coding units 710 a and 710 b, which are determined bysplitting the first coding unit 700 in a vertical direction, in ahorizontal direction order 710 c. The image decoding apparatus 100 maydetermine to process the second coding units 730 a and 730 b, which aredetermined by splitting the first coding unit 700 in a horizontaldirection, in a vertical direction order 730 c. The image decodingapparatus 100 may determine the second coding units 750 a, 750 b, 750 c,and 750 d, which are determined by splitting the first coding unit 700in vertical and horizontal directions, according to a predeterminedorder (e.g., a raster scan order or Z-scan order 750 e) by which codingunits in a row are processed and then coding units in a next row areprocessed.

According to an embodiment, the image decoding apparatus 100 mayrecursively split coding units. Referring to FIG. 7 , the image decodingapparatus 100 may determine the plurality of coding units 710 a and 710b, 730 a and 730 b, or 750 a, 750 b, 750 c, and 750 d by splitting thefirst coding unit 700, and may recursively split each of the determinedplurality of coding units 710 a, 710 b, 730 a, 730 b, 750 a, 750 b, 750c, and 750 d. A splitting method of the plurality of coding units 710 aand 710 b, 730 a and 730 b, or 750 a, 750 b, 750 c, and 750 d maycorrespond to a splitting method of the first coding unit 700.Accordingly, each of the plurality of coding units 710 a and 710 b, 730a and 730 b, or 750 a, 750 b, 750 c, and 750 d may be independentlysplit into a plurality of coding units. Referring to FIG. 7 , the imagedecoding apparatus 100 may determine the second coding units 710 a and710 b by splitting the first coding unit 700 in a vertical direction,and may determine to independently split or to not split each of thesecond coding units 710 a and 710 b.

According to an embodiment, the image decoding apparatus 100 maydetermine third coding units 720 a and 720 b by splitting the leftsecond coding unit 710 a in a horizontal direction, and may not splitthe right second coding unit 710 b.

According to an embodiment, a processing order of coding units may bedetermined based on an operation of splitting a coding unit. In otherwords, a processing order of split coding units may be determined basedon a processing order of coding units immediately before being split.The image decoding apparatus 100 may determine a processing order of thethird coding units 720 a and 720 b determined by splitting the leftsecond coding unit 710 a, independently of the right second coding unit710 b. Because the third coding units 720 a and 720 b are determined bysplitting the left second coding unit 710 a in a horizontal direction,the third coding units 720 a and 720 b may be processed in a verticaldirection order 720 c. Also, because the left and right second codingunits 710 a and 710 b are processed in the horizontal direction order710 c, the right second coding unit 710 b may be processed after thethird coding units 720 a and 720 b included in the left second codingunit 710 a are processed in the vertical direction order 720 c. Anoperation of determining a processing order of coding units based on acoding unit before being split is not limited to the above-describedexample, and various methods may be used to independently process codingunits, which are split and determined to various shapes, in apredetermined order.

FIG. 8 illustrates a process, performed by an image decoding apparatus,of determining that a current coding unit is to be split into an oddnumber of coding units, when the coding units are not processable in apredetermined order, according to an embodiment.

According to an embodiment, the image decoding apparatus 100 maydetermine that the current coding unit is to be split into an odd numberof coding units, based on obtained split shape mode information.Referring to FIG. 8 , a square first coding unit 800 may be split intonon-square second coding units 810 a and 810 b, and the second codingunits 810 a and 810 b may be independently split into third coding units820 a and 820 b, and 820 c, 820 d, and 820 e. According to anembodiment, the image decoding apparatus 100 may determine the pluralityof third coding units 820 a and 820 b by splitting the left secondcoding unit 810 a in a horizontal direction, and may split the rightsecond coding unit 810 b into the odd number of third coding units 820c, 820 d, and 820 e.

According to an embodiment, the video decoding apparatus 100 maydetermine whether any coding unit is split into an odd number of codingunits, by determining whether the third coding units 820 a and 820 b,and 820 c, 820 d, and 820 e are processable in a predetermined order.Referring to FIG. 8 , the image decoding apparatus 100 may determine thethird coding units 820 a and 820 b, and 820 c, 820 d, and 820 e byrecursively splitting the first coding unit 800. The image decodingapparatus 100 may determine whether any of the first coding unit 800,the second coding units 810 a and 810 b, or the third coding units 820 aand 820 b, and 820 c, 820 d, and 820 e are split into an odd number ofcoding units, based on at least one of the block shape information andthe split shape mode information. For example, a coding unit located inthe right from among the second coding units 810 a and 810 b may besplit into an odd number of third coding units 820 c, 820 d, and 820 e.A processing order of a plurality of coding units included in the firstcoding unit 800 may be a predetermined order (e.g., a Z-scan order 830),and the image decoding apparatus 100 may determine whether the thirdcoding units 820 c, 820 d, and 820 e, which are determined by splittingthe right second coding unit 810 b into an odd number of coding units,satisfy a condition for processing in the predetermined order.

According to an embodiment, the image decoding apparatus 100 maydetermine whether the third coding units 820 a and 820 b, and 820 c, 820d, and 820 e included in the first coding unit 800 satisfy the conditionfor processing in the predetermined order, and the condition relates towhether at least one of a width and height of the second coding units810 a and 810 b is to be split in half along a boundary of the thirdcoding units 820 a and 820 b, and 820 c, 820 d, and 820 e. For example,the third coding units 820 a and 820 b determined when the height of theleft second coding unit 810 a of the non-square shape is split in halfmay satisfy the condition. It may be determined that the third codingunits 820 c, 820 d, and 820 e do not satisfy the condition because theboundaries of the third coding units 820 c, 820 d, and 820 e determinedwhen the right second coding unit 810 b is split into three coding unitsare unable to split the width or height of the right second coding unit810 b in half. When the condition is not satisfied as described above,the image decoding apparatus 100 may determine disconnection of a scanorder, and may determine that the right second coding unit 810 b is tobe split into an odd number of coding units, based on a result of thedetermination. According to an embodiment, when a coding unit is splitinto an odd number of coding units, the image decoding apparatus 100 mayput a predetermined restriction on a coding unit at a predeterminedlocation from among the split coding units. The restriction or thepredetermined location has been described above in relation to variousembodiments, and thus detailed descriptions thereof will not be providedherein.

FIG. 9 illustrates a process, performed by an image decoding apparatus,of determining at least one coding unit by splitting a first codingunit, according to an embodiment.

According to an embodiment, the image decoding apparatus 100 may split afirst coding unit 900, based on split shape mode information, which isobtained through the receiver 110. The square first coding unit 900 maybe split into four square coding units, or may be split into a pluralityof non-square coding units. For example, referring to FIG. 9 , when thefirst coding unit 900 has a square shape and the split shape modeinformation indicates to split the first coding unit 900 into non-squarecoding units, the image decoding apparatus 100 may split the firstcoding unit 900 into a plurality of non-square coding units. In detail,when the split shape mode information indicates to determine an oddnumber of coding units by splitting the first coding unit 900 in ahorizontal direction or a vertical direction, the image decodingapparatus 100 may split the square first coding unit 900 into an oddnumber of coding units, e.g., second coding units 910 a, 910 b, and 910c determined by splitting the square first coding unit 900 in a verticaldirection or second coding units 920 a, 920 b, and 920 c determined bysplitting the square first coding unit 900 in a horizontal direction.

According to an embodiment, the image decoding apparatus 100 maydetermine whether the second coding units 910 a, 910 b, 910 c, 920 a,920 b, and 920 c included in the first coding unit 900 satisfy acondition for processing in a predetermined order, and the conditionrelates to whether at least one of a width and height of the firstcoding unit 900 is to be split in half along a boundary of the secondcoding units 910 a, 910 b, 910 c, 920 a, 920 b, and 920 c. Referring toFIG. 9 , because boundaries of the second coding units 910 a, 910 b, and910 c determined by splitting the square first coding unit 900 in avertical direction do not split the width of the first coding unit 900in half, it may be determined that the first coding unit 900 does notsatisfy the condition for processing in the predetermined order. Also,because boundaries of the second coding units 920 a, 920 b, and 920 cdetermined by splitting the square first coding unit 900 in a horizontaldirection do not split the height of the first coding unit 900 in half,it may be determined that the first coding unit 900 does not satisfy thecondition for processing in the predetermined order. When the conditionis not satisfied as described above, the image decoding apparatus 100may decide disconnection of a scan order, and may determine that thefirst coding unit 900 is to be split into an odd number of coding units,based on a result of the decision. According to an embodiment, when acoding unit is split into an odd number of coding units, the imagedecoding apparatus 100 may put a predetermined restriction on a codingunit at a predetermined location from among the split coding units. Therestriction or the predetermined location has been described above inrelation to various embodiments, and thus detailed descriptions thereofwill not be provided herein.

According to an embodiment, the image decoding apparatus 100 maydetermine various-shaped coding units by splitting a first coding unit.

Referring to FIG. 9 , the image decoding apparatus 100 may split thesquare first coding unit 900 or a non-square first coding unit 930 or950 into various-shaped coding units.

FIG. 10 illustrates that a shape into which a second coding unit issplittable is restricted when the second coding unit having a non-squareshape, which is determined when an image decoding apparatus splits afirst coding unit, satisfies a predetermined condition, according to anembodiment.

According to an embodiment, the image decoding apparatus 100 maydetermine to split a square first coding unit 1000 into non-squaresecond coding units 1010 a, and 1010 b or 1020 a and 1020 b, based onsplit shape mode information, which is obtained by the receiver 110. Thesecond coding units 1010 a and 1010 b, or 1020 a and 1020 b may beindependently split. As such, the image decoding apparatus 100 maydetermine to split or to not split each of the second coding units 1010a and 1010 b, or 1020 a and 1020 b into a plurality of coding units,based on the split shape mode information of each of the second codingunits 1010 a and 1010 b, or 1020 a and 1020 b. According to anembodiment, the image decoding apparatus 100 may determine third codingunits 1012 a and 1012 b by splitting the non-square left second codingunit 1010 a, which is determined by splitting the first coding unit 1000in a vertical direction, in a horizontal direction. However, when theleft second coding unit 1010 a is split in a horizontal direction, theimage decoding apparatus 100 may restrict the right second coding unit1010 b to not be split in a horizontal direction in which the leftsecond coding unit 1010 a is split. When third coding units 1014 a and1014 b are determined by splitting the right second coding unit 1010 bin a same direction, because the left and right second coding units 1010a and 1010 b are independently split in a horizontal direction, thethird coding units 1012 a and 1012 b, or 1014 a and 1014 b may bedetermined. However, this case serves equally as a case in which theimage decoding apparatus 100 splits the first coding unit 1000 into foursquare second coding units 1030 a, 1030 b, 1030 c, and 1030 d, based onthe split shape mode information, and may be inefficient in terms ofimage decoding.

According to an embodiment, the image decoding apparatus 100 maydetermine third coding units 1022 a and 1022 b, or 1024 a and 1024 b bysplitting the non-square second coding unit 1020 a or 1020 b, which isdetermined by splitting the first coding unit 1000 in a horizontaldirection, in a vertical direction. However, when a second coding unit(e.g., the upper second coding unit 1020 a) is split in a verticaldirection, for the above-described reason, the image decoding apparatus100 may restrict the other second coding unit (e.g., the lower secondcoding unit 1020 b) to not be split in a vertical direction in which theupper second coding unit 1020 a is split.

FIG. 11 illustrates a process, performed by an image decoding apparatus,of splitting a square coding unit when split shape mode informationindicates that the square coding unit is to not be split into foursquare coding units, according to an embodiment.

According to an embodiment, the image decoding apparatus 100 maydetermine second coding units 1110 a and 1110 b, or 1120 a and 1120 b,etc. by splitting a first coding unit 1100, based on split shape modeinformation. The split shape mode information may include informationabout various methods of splitting a coding unit but, the informationabout various splitting methods may not include information forsplitting a coding unit into four square coding units. According to suchsplit shape mode information, the image decoding apparatus 100 may notsplit the square first coding unit 1100 into four square second codingunits 1130 a, 1130 b, 1130 c, and 1130 d. The image decoding apparatus100 may determine the non-square second coding units 1110 a and 1110 b,or 1120 a and 1120 b, etc., based on the split shape mode information.

According to an embodiment, the image decoding apparatus 100 mayindependently split the non-square second coding units 1110 a and 1110b, or 1120 a and 1120 b, etc. Each of the second coding units 1110 a and1110 b, or 1120 a and 1120 b, etc. may be recursively split in apredetermined order, and this splitting method may correspond to amethod of splitting the first coding unit 1100, based on the split shapemode information.

For example, the image decoding apparatus 100 may determine square thirdcoding units 1112 a and 1112 b by splitting the left second coding unit1110 a in a horizontal direction, and may determine square third codingunits 1114 a and 1114 b by splitting the right second coding unit 1110 bin a horizontal direction. Furthermore, the image decoding apparatus 100may determine square third coding units 1116 a, 1116 b, 1116 c, and 1116d by splitting both of the left and right second coding units 1110 a and1110 b in a horizontal direction. In this case, coding units having thesame shape as the four square second coding units 1130 a, 1130 b, 1130c, and 1130 d split from the first coding unit 1100 may be determined.

As another example, the image decoding apparatus 100 may determinesquare third coding units 1122 a and 1122 b by splitting the uppersecond coding unit 1120 a in a vertical direction, and may determinesquare third coding units 1124 a and 1124 b by splitting the lowersecond coding unit 1120 b in a vertical direction. Furthermore, theimage decoding apparatus 100 may determine square third coding units1126 a, 1126 b, 1126 c, and 1126 d by splitting both the upper and lowersecond coding units 1120 a and 1120 b in a vertical direction. In thiscase, coding units having the same shape as the four square secondcoding units 1130 a, 1130 b, 1130 c, and 1130 d split from the firstcoding unit 1100 may be determined.

FIG. 12 illustrates that a processing order between a plurality ofcoding units may be changed depending on a process of splitting a codingunit, according to an embodiment.

According to an embodiment, the image decoding apparatus 100 may split afirst coding unit 1200, based on split shape mode information. When ablock shape indicates a square shape and the split shape modeinformation indicates to split the first coding unit 1200 in at leastone of horizontal and vertical directions, the image decoding apparatus100 may determine second coding units 1210 a and 1210 b, or 1220 a and1220 b, etc. by splitting the first coding unit 1200. Referring to FIG.12 , the non-square second coding units 1210 a and 1210 b, or 1220 a and1220 b determined by splitting the first coding unit 1200 in only ahorizontal direction or vertical direction may be independently splitbased on the split shape mode information of each coding unit. Forexample, the image decoding apparatus 100 may determine third codingunits 1216 a, 1216 b, 1216 c, and 1216 d by splitting the second codingunits 1210 a and 1210 b, which are generated by splitting the firstcoding unit 1200 in a vertical direction, in a horizontal direction, andmay determine third coding units 1226 a, 1226 b, 1226 c, and 1226 d bysplitting the second coding units 1220 a and 1220 b, which are generatedby splitting the first coding unit 1200 in a horizontal direction, in avertical direction. An operation of splitting the second coding units1210 a and 1210 b, or 1220 a and 1220 b has been described above inrelation to FIG. 11 , and thus detailed descriptions thereof will not beprovided herein.

According to an embodiment, the image decoding apparatus 100 may processcoding units in a predetermined order. An operation of processing codingunits in a predetermined order has been described above in relation toFIG. 7 , and thus detailed descriptions thereof will not be providedherein. Referring to FIG. 12 , the image decoding apparatus 100 maydetermine four square third coding units 1216 a, 1216 b, 1216 c, and1216 d, and 1226 a, 1226 b, 1226 c, and 1226 d by splitting the squarefirst coding unit 1200. According to an embodiment, the image decodingapparatus 100 may determine processing orders of the third coding units1216 a, 1216 b, 1216 c, and 1216 d, and 1226 a, 1226 b, 1226 c, and 1226d based on a split shape by which the first coding unit 1200 is split.

According to an embodiment, the image decoding apparatus 100 maydetermine the third coding units 1216 a, 1216 b, 1216 c, and 1216 d bysplitting the second coding units 1210 a and 1210 b generated bysplitting the first coding unit 1200 in a vertical direction, in ahorizontal direction, and may process the third coding units 1216 a,1216 b, 1216 c, and 1216 d in a processing order 1217 for initiallyprocessing the third coding units 1216 a and 1216 c, which are includedin the left second coding unit 1210 a, in a vertical direction and thenprocessing the third coding unit 1216 b and 1216 d, which are includedin the right second coding unit 1210 b, in a vertical direction.

According to an embodiment, the image decoding apparatus 100 maydetermine the third coding units 1226 a, 1226 b, 1226 c, and 1226 d bysplitting the second coding units 1220 a and 1220 b generated bysplitting the first coding unit 1200 in a horizontal direction, in avertical direction, and may process the third coding units 1226 a, 1226b, 1226 c, and 1226 d in a processing order 1227 for initiallyprocessing the third coding units 1226 a and 1226 b, which are includedin the upper second coding unit 1220 a, in a horizontal direction andthen processing the third coding unit 1226 c and 1226 d, which areincluded in the lower second coding unit 1220 b, in a horizontaldirection.

Referring to FIG. 12 , the square third coding units 1216 a, 1216 b,1216 c, and 1216 d, and 1226 a, 1226 b, 1226 c, and 1226 d may bedetermined by splitting the second coding units 1210 a and 1210 b, and1220 a and 1220 b, respectively. Although the second coding units 1210 aand 1210 b are determined by splitting the first coding unit 1200 in avertical direction differently from the second coding units 1220 a and1220 b which are determined by splitting the first coding unit 1200 in ahorizontal direction, the third coding units 1216 a, 1216 b, 1216 c, and1216 d, and 1226 a, 1226 b, 1226 c, and 1226 d split therefromeventually show same-shaped coding units split from the first codingunit 1200. As such, by recursively splitting a coding unit in differentmanners based on the split shape mode information, the image decodingapparatus 100 may process a plurality of coding units in differentorders even when the coding units are eventually determined to be thesame shape.

FIG. 13 illustrates a process of determining a depth of a coding unit asa shape and a size of the coding unit change, when the coding unit isrecursively split such that a plurality of coding units are determined,according to an embodiment.

According to an embodiment, the image decoding apparatus 100 maydetermine the depth of the coding unit, based on a predeterminedcriterion. For example, the predetermined criterion may be the length ofa long side of the coding unit. When the length of a long side of acoding unit before being split is 2n times (n>0) the length of a longside of a split current coding unit, the image decoding apparatus 100may determine that a depth of the current coding unit is increased froma depth of the coding unit before being split, by n. In the followingdescriptions, a coding unit having an increased depth is expressed as acoding unit of a lower depth.

Referring to FIG. 13 , according to an embodiment, the image decodingapparatus 100 may determine a second coding unit 1302 and a third codingunit 1304 of lower depths by splitting a square first coding unit 1300based on block shape information indicating a square shape (e.g., theblock shape information may be expressed as ‘0: SQUARE’). Assuming thatthe size of the square first coding unit 1300 is 2N×2N, the secondcoding unit 1302 determined by splitting a width and height of the firstcoding unit 1300 in ½ may have a size of N×N. Furthermore, the thirdcoding unit 1304 determined by splitting a width and height of thesecond coding unit 1302 in ½ may have a size of N/2×N/2. In this case, awidth and height of the third coding unit 1304 are ¼ times those of thefirst coding unit 1300. When a depth of the first coding unit 1300 is D,a depth of the second coding unit 1302, the width and height of whichare ½ times those of the first coding unit 1300, may be D+1, and a depthof the third coding unit 1304, the width and height of which are ¼ timesthose of the first coding unit 1300, may be D+2.

According to an embodiment, the image decoding apparatus 100 maydetermine a second coding unit 1312 or 1322 and a third coding unit 1314or 1324 of lower depths by splitting a non-square first coding unit 1310or 1320 based on block shape information indicating a non-square shape(e.g., the block shape information may be expressed as ‘1: NS_VER’indicating a non-square shape, a height of which is longer than a width,or as ‘2: NS_HOR’ indicating a non-square shape, a width of which islonger than a height).

The image decoding apparatus 100 may determine a second coding unit1302, 1312, or 1322 by splitting at least one of a width and height ofthe first coding unit 1310 having a size of N×2N. That is, the imagedecoding apparatus 100 may determine the second coding unit 1302 havinga size of N×N or the second coding unit 1322 having a size of N×N/2 bysplitting the first coding unit 1310 in a horizontal direction, or maydetermine the second coding unit 1312 having a size of N/2×N bysplitting the first coding unit 1310 in horizontal and verticaldirections.

According to an embodiment, the image decoding apparatus 100 maydetermine the second coding unit 1302, 1312, or 1322 by splitting atleast one of a width and height of the first coding unit 1320 having asize of 2N×N. That is, the image decoding apparatus 100 may determinethe second coding unit 1302 having a size of N×N or the second codingunit 1312 having a size of N/2×N by splitting the first coding unit 1320in a vertical direction, or may determine the second coding unit 1322having a size of N×N/2 by splitting the first coding unit 1320 inhorizontal and vertical directions.

According to an embodiment, the image decoding apparatus 100 maydetermine a third coding unit 1304, 1314, or 1324 by splitting at leastone of a width and height of the second coding unit 1302 having a sizeof N×N. That is, the image decoding apparatus 100 may determine thethird coding unit 1304 having a size of N/2×N/2, the third coding unit1314 having a size of N/4×N/2, or the third coding unit 1324 having asize of N/2×N/4 by splitting the second coding unit 1302 in vertical andhorizontal directions.

According to an embodiment, the image decoding apparatus 100 maydetermine the third coding unit 1304, 1314, or 1324 by splitting atleast one of a width and height of the second coding unit 1312 having asize of N/2×N. That is, the image decoding apparatus 100 may determinethe third coding unit 1304 having a size of N/2×N/2 or the third codingunit 1324 having a size of N/2×N/4 by splitting the second coding unit1312 in a horizontal direction, or may determine the third coding unit1314 having a size of N/4×N/2 by splitting the second coding unit 1312in vertical and horizontal directions.

According to an embodiment, the image decoding apparatus 100 maydetermine the third coding unit 1304, 1314, or 1324 by splitting atleast one of a width and height of the second coding unit 1322 having asize of N×N/2. That is, the image decoding apparatus 100 may determinethe third coding unit 1304 having a size of N/2×N/2 or the third codingunit 1314 having a size of N/4×N/2 by splitting the second coding unit1322 in a vertical direction, or may determine the third coding unit1324 having a size of N/2×N/4 by splitting the second coding unit 1322in vertical and horizontal directions.

According to an embodiment, the image decoding apparatus 100 may splitthe square coding unit 1300, 1302, or 1304 in a horizontal or verticaldirection. For example, the image decoding apparatus 100 may determinethe first coding unit 1310 having a size of N×2N by splitting the firstcoding unit 1300 having a size of 2N×2N in a vertical direction, or maydetermine the first coding unit 1320 having a size of 2N×N by splittingthe first coding unit 1300 in a horizontal direction. According to anembodiment, when a depth is determined based on the length of thelongest side of a coding unit, a depth of a coding unit determined bysplitting the first coding unit 1300 having a size of 2N×2N in ahorizontal or vertical direction may be the same as the depth of thefirst coding unit 1300.

According to an embodiment, a width and height of the third coding unit1314 or 1324 may be ¼ times those of the first coding unit 1310 or 1320.When a depth of the first coding unit 1310 or 1320 is D, a depth of thesecond coding unit 1312 or 1322, the width and height of which are ½times those of the first coding unit 1310 or 1320, may be D+1, and adepth of the third coding unit 1314 or 1324, the width and height ofwhich are ¼ times those of the first coding unit 1310 or 1320, may beD+2.

FIG. 14 illustrates depths that are determinable based on shapes andsizes of coding units, and part indices (PIDs) that are fordistinguishing the coding units, according to an embodiment.

According to an embodiment, the image decoding apparatus 100 maydetermine various-shape second coding units by splitting a square firstcoding unit 1400. Referring to FIG. 14 , the image decoding apparatus100 may determine second coding units 1402 a and 1402 b, 1404 a and 1404b, and 1406 a, 1406 b, 1406 c, and 1406 d by splitting the first codingunit 1400 in at least one of vertical and horizontal directions based onsplit shape mode information. That is, the image decoding apparatus 100may determine the second coding units 1402 a and 1402 b, 1404 a and 1404b, and 1406 a, 1406 b, 1406 c, and 1406 d, based on the split shape modeinformation of the first coding unit 1400.

According to an embodiment, depths of the second coding units 1402 a and1402 b, 1404 a and 1404 b, and 1406 a, 1406 b, 1406 c, and 1406 d thatare determined based on the split shape mode information of the squarefirst coding unit 1400 may be determined based on the length of a longside thereof. For example, because the length of a side of the squarefirst coding unit 1400 equals the length of a long side of thenon-square second coding units 1402 a and 1402 b, and 1404 a and 1404 b,the first coding unit 1400 and the non-square second coding units 1402 aand 1402 b, and 1404 a and 1404 b may have the same depth, e.g., D.However, when the image decoding apparatus 100 splits the first codingunit 1400 into the four square second coding units 1406 a, 1406 b, 1406c, and 1406 d based on the split shape mode information, because thelength of a side of the square second coding units 1406 a, 1406 b, 1406c, and 1406 d is ½ times the length of a side of the first coding unit1400, a depth of the second coding units 1406 a, 1406 b, 1406 c, and1406 d may be D+1 which is deeper than the depth D of the first codingunit 1400 by 1.

According to an embodiment, the image decoding apparatus 100 maydetermine a plurality of second coding units 1412 a and 1412 b, and 1414a, 1414 b, and 1414 c by splitting a first coding unit 1410, a height ofwhich is longer than a width, in a horizontal direction based on thesplit shape mode information. According to an embodiment, the imagedecoding apparatus 100 may determine a plurality of second coding units1422 a and 1422 b, and 1424 a, 1424 b, and 1424 c by splitting a firstcoding unit 1420, a width of which is longer than a height, in avertical direction based on the split shape mode information.

According to an embodiment, a depth of the second coding units 1412 aand 1412 b, and 1414 a, 1414 b, and 1414 c, or 1422 a and 1422 b, and1424 a, 1424 b, and 1424 c, which are determined based on the splitshape mode information of the non-square first coding unit 1410 or 1420,may be determined based on the length of a long side thereof. Forexample, because the length of a side of the square second coding units1412 a and 1412 b is ½ times the length of a long side of the firstcoding unit 1410 having a non-square shape, a height of which is longerthan a width, a depth of the square second coding units 1412 a and 1412b is D+1 which is deeper than the depth D of the non-square first codingunit 1410 by 1.

Furthermore, the image decoding apparatus 100 may split the non-squarefirst coding unit 1410 into an odd number of second coding units 1414 a,1414 b, and 1414 c based on the split shape mode information. The oddnumber of second coding units 1414 a, 1414 b, and 1414 c may include thenon-square second coding units 1414 a and 1414 c and the square secondcoding unit 1414 b. In this case, because the length of a long side ofthe non-square second coding units 1414 a and 1414 c and the length of aside of the square second coding unit 1414 b are ½ times the length of along side of the first coding unit 1410, a depth of the second codingunits 1414 a, 1414 b, and 1414 c may be D+1 which is deeper than thedepth D of the non-square first coding unit 1410 by 1. The imagedecoding apparatus 100 may determine depths of coding units split fromthe first coding unit 1420 having a non-square shape, a width of whichis longer than a height, by using the above-described method ofdetermining depths of coding units split from the first coding unit1410.

According to an embodiment, the image decoding apparatus 100 maydetermine PIDs for identifying split coding units, based on a size ratiobetween the coding units when an odd number of split coding units do nothave equal sizes. Referring to FIG. 14 , a coding unit 1414 b of acenter location among an odd number of split coding units 1414 a, 1414b, and 1414 c may have a width equal to that of the other coding units1414 a and 1414 c and a height which is two times that of the othercoding units 1414 a and 1414 c. That is, in this case, the coding unit1414 b at the center location may include two of the other coding unit1414 a or 1414 c. Therefore, when a PID of the coding unit 1414 b at thecenter location is 1 based on a scan order, a PID of the coding unit1414 c located next to the coding unit 1414 b may be increased by 2 andthus may be 3. That is, discontinuity in PID values may be present.According to an embodiment, the image decoding apparatus 100 maydetermine whether an odd number of split coding units do not have equalsizes, based on whether discontinuity is present in PIDs for identifyingthe split coding units.

According to an embodiment, the image decoding apparatus 100 maydetermine whether to use a specific splitting method, based on PIDvalues for identifying a plurality of coding units determined bysplitting a current coding unit. Referring to FIG. 14 , the imagedecoding apparatus 100 may determine an even number of coding units 1412a and 1412 b or an odd number of coding units 1414 a, 1414 b, and 1414 cby splitting the first coding unit 1410 having a rectangular shape, aheight of which is longer than a width. The image decoding apparatus 100may use PIDs indicating respective coding units so as to identify therespective coding units. According to an embodiment, the PID may beobtained from a sample at a predetermined location of each coding unit(e.g., an upper-left sample).

According to an embodiment, the image decoding apparatus 100 maydetermine a coding unit at a predetermined location from among the splitcoding units, by using the PIDs for distinguishing the coding units.According to an embodiment, when the split shape mode information of thefirst coding unit 1410 having a rectangular shape, a height of which islonger than a width, indicates to split a coding unit into three codingunits, the image decoding apparatus 100 may split the first coding unit1410 into three coding units 1414 a, 1414 b, and 1414 c. The imagedecoding apparatus 100 may assign a PID to each of the three codingunits 1414 a, 1414 b, and 1414 c. The image decoding apparatus 100 maycompare PIDs of an odd number of split coding units to determine acoding unit at a center location from among the coding units. The imagedecoding apparatus 100 may determine the coding unit 1414 b having a PIDcorresponding to a middle value among the PIDs of the coding units, asthe coding unit at the center location from among the coding unitsdetermined by splitting the first coding unit 1410. According to anembodiment, the image decoding apparatus 100 may determine PIDs fordistinguishing split coding units, based on a size ratio between thecoding units when the split coding units do not have equal sizes.Referring to FIG. 14 , the coding unit 1414 b generated by splitting thefirst coding unit 1410 may have a width equal to that of the othercoding units 1414 a and 1414 c and a height which is two times that ofthe other coding units 1414 a and 1414 c. In this case, when the PID ofthe coding unit 1414 b at the center location is 1, the PID of thecoding unit 1414 c located next to the coding unit 1414 b may beincreased by 2 and thus may be 3. When the PID is not uniformlyincreased as described above, the image decoding apparatus 100 maydetermine that a coding unit is split into a plurality of coding unitsincluding a coding unit having a size different from that of the othercoding units. According to an embodiment, when the split shape modeinformation indicates to split a coding unit into an odd number ofcoding units, the image decoding apparatus 100 may split a currentcoding unit in such a manner that a coding unit of a predeterminedlocation among an odd number of coding units (e.g., a coding unit of acenter location) has a size different from that of the other codingunits. In this case, the image decoding apparatus 100 may determine thecoding unit of the center location, which has a different size, by usingPIDs of the coding units. However, the PIDs and the size or location ofthe coding unit of the predetermined location are not limited to theabove-described examples, and various PIDs and various locations andsizes of coding units may be used.

According to an embodiment, the image decoding apparatus 100 may use apredetermined data unit where a coding unit starts to be recursivelysplit.

FIG. 15 illustrates that a plurality of coding units are determinedbased on a plurality of predetermined data units included in a picture,according to an embodiment.

According to an embodiment, a predetermined data unit may be defined asa data unit where a coding unit starts to be recursively split by usingsplit shape mode information. That is, the predetermined data unit maycorrespond to a coding unit of an uppermost depth, which is used todetermine a plurality of coding units split from a current picture. Inthe following descriptions, for convenience of explanation, thepredetermined data unit is referred to as a reference data unit.

According to an embodiment, the reference data unit may have apredetermined size and a predetermined shape. According to anembodiment, a reference coding unit may include M×N samples. Herein, Mand N may be equal to each other, and may be integers expressed aspowers of 2. That is, the reference data unit may have a square ornon-square shape, and may be split into an integer number of codingunits.

According to an embodiment, the image decoding apparatus 100 may splitthe current picture into a plurality of reference data units. Accordingto an embodiment, the image decoding apparatus 100 may split theplurality of reference data units, which are split from the currentpicture, by using the split shape mode information of each referencedata unit. The operation of splitting the reference data unit maycorrespond to a splitting operation using a quadtree structure.

According to an embodiment, the image decoding apparatus 100 maypredetermine the minimum size allowed for the reference data unitsincluded in the current picture. Accordingly, the image decodingapparatus 100 may determine various reference data units having sizesequal to or greater than the minimum size, and may determine one or morecoding units by using the split shape mode information with reference tothe determined reference data unit.

Referring to FIG. 15 , the image decoding apparatus 100 may use a squarereference coding unit 1500 or a non-square reference coding unit 1502.According to an embodiment, the shape and size of reference coding unitsmay be determined based on various data units capable of including oneor more reference coding units (e.g., sequences, pictures, slices, slicesegments, tiles, tile groups, largest coding units, or the like).

According to an embodiment, the receiver 110 of the image decodingapparatus 100 may obtain, from a bitstream, at least one of referencecoding unit shape information and reference coding unit size informationwith respect to each of the various data units. An operation ofsplitting the square reference coding unit 1500 into one or more codingunits has been described above in relation to the operation of splittingthe current coding unit 300 of FIG. 3 , and an operation of splittingthe non-square reference coding unit 1502 into one or more coding unitshas been described above in relation to the operation of splitting thecurrent coding unit 400 or 450 of FIG. 4 . Thus, detailed descriptionsthereof will not be provided herein.

According to an embodiment, the image decoding apparatus 100 may use aPID for identifying the size and shape of reference coding units, todetermine the size and shape of reference coding units according to somedata units predetermined based on a predetermined condition. That is,the receiver 110 may obtain, from the bitstream, only the PID foridentifying the size and shape of reference coding units with respect toeach slice, slice segment, tile, tile group, or largest coding unitwhich is a data unit satisfying a predetermined condition (e.g., a dataunit having a size equal to or smaller than a slice) among the variousdata units (e.g., sequences, pictures, slices, slice segments, tiles,tile groups, largest coding units, or the like). The image decodingapparatus 100 may determine the size and shape of reference data unitswith respect to each data unit, which satisfies the predeterminedcondition, by using the PID. When the reference coding unit shapeinformation and the reference coding unit size information are obtainedand used from the bitstream according to each data unit having arelatively small size, efficiency of using the bitstream may not behigh, and therefore, only the PID may be obtained and used instead ofdirectly obtaining the reference coding unit shape information and thereference coding unit size information. In this case, at least one ofthe size and shape of reference coding units corresponding to the PIDfor identifying the size and shape of reference coding units may bepredetermined. That is, the image decoding apparatus 100 may determineat least one of the size and shape of reference coding units included ina data unit serving as a unit for obtaining the PID, by selecting thepredetermined at least one of the size and shape of reference codingunits based on the PID.

According to an embodiment, the image decoding apparatus 100 may use oneor more reference coding units included in a largest coding unit. Thatis, a largest coding unit split from a picture may include one or morereference coding units, and coding units may be determined byrecursively splitting each reference coding unit. According to anembodiment, at least one of a width and height of the largest codingunit may be integer times at least one of the width and height of thereference coding units. According to an embodiment, the size ofreference coding units may be obtained by splitting the largest codingunit n times based on a quadtree structure. That is, the image decodingapparatus 100 may determine the reference coding units by splitting thelargest coding unit n times based on a quadtree structure, and may splitthe reference coding unit based on at least one of the block shapeinformation and the split shape mode information according to variousembodiments.

According to an embodiment, the image decoding apparatus 100 may obtainblock shape information indicating the shape of a current coding unit orsplit shape mode information indicating a splitting method of thecurrent coding unit, from the bitstream, and may use the obtainedinformation. The split shape mode information may be included in thebitstream related to various data units. For example, the image decodingapparatus 100 may use the split shape mode information included in asequence parameter set, a picture parameter set, a video parameter set,a slice header, a slice segment header, a tile header, or a tile groupheader. Furthermore, the image decoding apparatus 100 may obtain, fromthe bitstream, a syntax element corresponding to the block shapeinformation or the split shape mode information according to eachlargest coding unit, each reference coding unit, or each processingblock, and may use the obtained syntax element.

Hereinafter, a method of determining a split rule, according to anembodiment of the disclosure will be described in detail.

The image decoding apparatus 100 may determine a split rule of an image.The split rule may be predetermined between the image decoding apparatus100 and the image encoding apparatus 2200. The image decoding apparatus100 may determine the split rule of the image, based on informationobtained from a bitstream. The image decoding apparatus 100 maydetermine the split rule based on the information obtained from at leastone of a sequence parameter set, a picture parameter set, a videoparameter set, a slice header, a slice segment header, a tile header,and a tile group header. The image decoding apparatus 100 may determinethe split rule differently according to frames, slices, tiles, temporallayers, largest coding units, or coding units.

The image decoding apparatus 100 may determine the split rule based on ablock shape of a coding unit. The block shape may include a size, shape,a ratio of width and height, and a direction of the coding unit. Theimage decoding apparatus 100 may predetermine to determine the splitrule based on the block shape of the coding unit. However, theembodiment is not limited thereto. The image decoding apparatus 100 maydetermine the split rule based on the information obtained from thereceived bitstream.

The shape of the coding unit may include a square and a non-square. Whenthe lengths of the width and height of the coding unit are the same, theimage decoding apparatus 100 may determine the shape of the coding unitto be a square. Also, when the lengths of the width and height of thecoding unit are not the same, the image decoding apparatus 100 maydetermine the shape of the coding unit to be a non-square.

The size of the coding unit may include various sizes, such as 4×4, 8×4,4×8, 8×8, 16×4, 16×8, and to 256×256. The size of the coding unit may beclassified based on the length of a long side of the coding unit, thelength of a short side, or the area. The image decoding apparatus 100may apply the same split rule to coding units classified as the samegroup. For example, the image decoding apparatus 100 may classify codingunits having the same lengths of the long sides as having the same size.Also, the image decoding apparatus 100 may apply the same split rule tocoding units having the same lengths of long sides.

The ratio of the width and height of the coding unit may include 1:2,2:1, 1:4, 4:1, 1:8, 8:1, 1:16, 16:1, 32:1, 1:32, or the like. Also, adirection of the coding unit may include a horizontal direction and avertical direction. The horizontal direction may indicate a case inwhich the length of the width of the coding unit is longer than thelength of the height thereof. The vertical direction may indicate a casein which the length of the width of the coding unit is shorter than thelength of the height thereof.

The image decoding apparatus 100 may adaptively determine the split rulebased on the size of the coding unit. The image decoding apparatus 100may differently determine an allowable split shape mode based on thesize of the coding unit. For example, the image decoding apparatus 100may determine whether splitting is allowed based on the size of thecoding unit. The image decoding apparatus 100 may determine a splitdirection according to the size of the coding unit. The image decodingapparatus 100 may determine an allowable split type according to thesize of the coding unit.

The split rule determined based on the size of the coding unit may be asplit rule predetermined in the image decoding apparatus 100. Also, theimage decoding apparatus 100 may determine the split rule based on theinformation obtained from the bitstream.

The image decoding apparatus 100 may adaptively determine the split rulebased on a location of the coding unit. The image decoding apparatus 100may adaptively determine the split rule based on the location of thecoding unit in the image.

Also, the image decoding apparatus 100 may determine the split rule suchthat coding units generated via different splitting paths do not havethe same block shape. However, an embodiment is not limited thereto, andthe coding units generated via different splitting paths have the sameblock shape. The coding units generated via the different splittingpaths may have different decoding processing orders. Because thedecoding processing orders is described above with reference to FIG. 12, details thereof are not provided again.

FIG. 16 is a block diagram of an image encoding and decoding system.

An encoding end 1610 of an image encoding and decoding system 1600transmits an encoded bitstream of an image and a decoding end 1650outputs a reconstructed image by receiving and decoding the bitstream.Here, the decoding end 1550 may have a similar configuration as theimage decoding apparatus 100.

At the encoding end 1610, a prediction encoder 1615 outputs a referenceimage via inter-prediction and intra-prediction, and a transformer andquantizer 1620 quantizes residual data between the reference picture anda current input image to a quantized transform coefficient and outputsthe quantized transform coefficient. An entropy encoder 1625 transformsthe quantized transform coefficient by encoding the quantized transformcoefficient, and outputs the transformed quantized transform coefficientas a bitstream. The quantized transform coefficient is reconstructed asdata of a spatial domain via an inverse quantizer and inversetransformer 1630, and the data of the spatial domain is output as areconstructed image via a deblocking filter 1635 and a loop filter 1640.The reconstructed image may be used as a reference image of a next inputimage via the prediction encoder 1615.

Encoded image data among the bitstream received by the decoding end 1650is reconstructed as residual data of a spatial domain via an entropydecoder 1655 and an inverse quantizer and inverse transformer 1660.Image data of a spatial domain is configured when a reference image andresidual data output from a prediction decoder 1675 are combined, and adeblocking filter 1665 and a loop filter 1670 may output a reconstructedimage regarding a current original image by performing filtering on theimage data of the spatial domain. The reconstructed image may be used bythe prediction decoder 1675 as a reference image for a next originalimage.

The loop filter 1640 of the encoding end 1610 performs loop filtering byusing filter information input according to a user input or systemsetting. The filter information used by the loop filter 1640 is outputto the entropy encoder 1625 and transmitted to the decoding end 1650together with the encoded image data. The loop filter 1670 of thedecoding end 1650 may perform loop filtering based on the filterinformation input from the decoding end 1650.

Hereinafter, with reference to FIGS. 17 to 20 , a method and apparatusfor encoding or decoding a video by expanding a merge mode with motionvector difference, according to an embodiment disclosed in the presentspecification will now be described.

FIG. 17 is a block diagram of a video decoding apparatus according to anembodiment.

Referring to FIG. 17 , a video decoding apparatus 1700 according to anembodiment may include a syntax element obtainer 1710 and a decoder1720.

The video decoding apparatus 1700 may obtain a bitstream generated as aresult of encoding an image, and may decode motion information forinter-prediction based on information included in the bitstream.

The video decoding apparatus 1700 according to an embodiment may includea central processor (not shown) for controlling the syntax elementobtainer 1710 and the decoder 1720. Alternatively, the syntax elementobtainer 1710 and the decoder 1720 may operate by their own processors(not shown), and the processors may systematically operate with eachother to operate the video decoding apparatus 1700. Alternatively, thesyntax element obtainer 1710 and the decoder 1720 may be controlledaccording to control by an external processor (not shown) of the videodecoding apparatus 1700.

The video decoding apparatus 1700 may include one or more data storages(not shown) storing input/output data of the syntax element obtainer1710 and the decoder 1720. The video decoding apparatus 1700 may includea memory controller (not shown) for controlling data input and output toand from the data storage.

The video decoding apparatus 1700 may perform an image decodingoperation including prediction by connectively operating with aninternal video decoding processor or an external video decodingprocessor so as to reconstruct an image via image decoding. The internalvideo decoding processor of the video decoding apparatus 1700 accordingto an embodiment may perform a basic image decoding operation in amanner that not only a separate processor but also an image decodingprocessing module included in a central processing apparatus or agraphic processing apparatus perform the basic image decoding operation.

The video decoding apparatus 1700 may be included in the image decodingapparatus 100 described above. For example, the syntax element obtainer1710 may be included in the receiver 110 of the image decoding apparatus100 of FIG. 1 , and the syntax element obtainer 1710 and the decoder1720 may be included in the decoder 120 of the image decoding apparatus100.

The syntax element obtainer 1710 receives a bitstream generated as aresult of encoding an image. The bitstream may include information fordetermining a motion vector used for inter prediction of a currentblock. The current block is a block generated when an image is splitaccording to a tree structure, and for example, may correspond to alargest coding unit, a coding unit, or a transform unit.

The syntax element obtainer 1710 may determine the current block basedon block shape information and/or information about a split shape mode,which are included in at least one of a sequence parameter set, apicture parameter set, a video parameter set, a slice header, and aslice segment header. Furthermore, the syntax element obtainer 1710 mayobtain, from the bitstream, a syntax element corresponding to the blockshape information or the information about the split shape modeaccording to each largest coding unit, each reference coding unit, oreach processing block, and may use the obtained syntax element todetermine the current block.

The bitstream may include information indicating a prediction mode ofthe current block, and the prediction mode of the current block mayinclude an intra mode and an inter mode. When the prediction mode of thecurrent block is the inter mode, an encoding/decoding scheme of a motionvector may include at least one of a merge mode, a skip mode, and anMMVD mode. In the merge mode or the skip mode, a merge candidate listincluding motion vector candidates is used, and one motion vectorcandidate indicated by a merge index from among the motion vectorcandidates may be determined to be a merge motion vector candidate. TheMMVD mode represents a merge mode with motion vector difference, and maybe a mode in which a prediction motion vector of the current block isdetermined by applying a motion vector difference distinguishedaccording to a distance of a difference and a direction of the distance,to one base motion vector determined from among the motion vectorcandidates.

According to an embodiment, information related to the MMVD mode may beobtained from the bitstream. The information related to the MMVD modeaccording to an embodiment may include at least one of informationindicating whether the MMVD mode is used for the current block(hereinafter, MMVD information), information indicating the base motionvector of the current block (hereinafter, merge index), informationindicating the distance of the difference from the base motion vector tomotion vector candidates (hereinafter, a distance index of adifference), and information indicating the difference direction fromthe base motion vector to the motion vector candidates (hereinafter, adirection index of the difference).

The syntax element obtainer 1710 may obtain the information related tothe MMVD mode in the form of a syntax element from a syntaxcorresponding to at least one unit from among a coding unit, a transformunit, a largest coding unit, a slice unit, and a picture unit.

The video decoding apparatus 1700 may receive the syntax in the form ofa bitstream, may obtain the syntax element from the syntax by performingentropy decoding, and may interpret various pieces of informationindicated by each syntax element. Therefore, it may be understood thatthe syntax element obtainer 1710 obtains various pieces of information(syntax elements) from the bitstream (syntax).

The decoder 1720 may verify whether the MMVD mode is used for thecurrent block, based on the MMVD information obtained from thebitstream. The information indicating whether the MMVD mode is appliedmay include a flag or an index.

According to an embodiment, the MMVD mode may be applied to varioustools that are available in an inter prediction mode. Accordingly, thevideo decoding apparatus 1700 needs to determine whether the MMVD modeis applied to each tool of the inter prediction mode.

For example, in a first scheme, whether the MMVD mode is applied to eachtool may be determined only.

As another example, in a second scheme, after whether the MMVD mode isapplied to all tools is first determined, if applicable, whether theMMVD mode is applied to each tool is determined. When the MMVD mode isnot applied to all tools, it is not necessary to determine whether theMMVD mode is applied to each tool.

To determine whether to apply the MMVD mode, the video decodingapparatus 1700 according to an embodiment may obtain, from a bitstream,a syntax element including information such as a flag. Therefore, in thefirst scheme, even when the MMVD mode is not applied to various tools,the video decoding apparatus 1700 has to obtain, from a bitstream, aflag for determining that the MMVD mode is not applied to each ofvarious tools.

However, according to the second scheme, the video decoding apparatus1700 may first obtain, from the bitstream, a flag indicating whether theMMVD mode is enabled for various tools. When the MMVD mode isapplicable, based on the flag, the video decoding apparatus 1700 mayobtain a flag for each tool so as to determine whether the MMVD mode isapplied. When the MMVD mode is not applicable, based on the flagindicating whether the MMVD mode is enabled for various tools, the videodecoding apparatus 1700 does not need to additionally obtain a flagindicating whether the MMVD mode is applied to each tool, such thatdecoding efficiency may be increased.

Hereinafter, an embodiment will now be described, in which, for eachsequence and according to the second scheme, the video decodingapparatus 1700 first determines whether the MMVD mode is applicable, andif applicable, determines whether the MMVD mode is applied to aparticular tool.

The syntax element obtainer 1710 according to an embodiment may obtain,from a sequence parameter set, sequence MMVD information indicatingwhether the MMVD mode is applicable in a current sequence. The MMVD modein a sequence collectively refers to prediction modes of adjusting amotion vector by using a distance index and a direction index of themotion vector which are signaled separately from the motion vector, invarious inter prediction modes performed at a data level equal to orless than a sequence. When the MMVD mode is applicable according to thesequence MMVD information, the syntax element obtainer 1710 according toan embodiment may additionally obtain first MMVD information indicatingwhether the MMVD mode is applied in a first inter prediction mode andsecond MMVD information indicating whether the MMVD mode is applied in asecond inter prediction mode for a current block included in the currentsequence. When the MMVD mode is applied in the first inter predictionmode according to the first MMVD information, the decoder 1720 mayreconstruct a motion vector according to the MMVD mode in the firstinter prediction mode, and when the MMVD mode is applied in the secondinter prediction mode according to the second MMVD information, thedecoder 1720 may reconstruct the motion vector according to the MMVDmode in the second inter prediction mode. However, when the MMVD mode isnot applicable according to the sequence MMVD information, the syntaxelement obtainer 1710 according to an embodiment does not need toobtain, from the bitstream, the first MMVD information and the secondMMVD information.

In a particular example, the syntax element obtainer 1710 may obtain,from the sequence parameter set, the sequence MMVD informationindicating whether the MMVD mode is applicable in the current sequence.When the MMVD mode is applicable according to the sequence MMVDinformation, the syntax element obtainer 1710 according to an embodimentmay obtain sequence sub-pixel MMVD information indicating whether amotion vector difference in an integer pixel unit is used or a motionvector difference in a sub-pixel unit is used in the current sequence.When the MMVD mode is applicable according to the sequence MMVDinformation, the syntax element obtainer 1710 according to an embodimentmay obtain MMVD information indicating whether the MMVD mode is used forthe current block included in the current sequence.

When the MMVD mode is used for the current block according to the MMVDinformation, the decoder 1720 may reconstruct, according to the MMVDinformation, a distance of a motion vector difference in an integerpixel unit or a sub-pixel unit from a distance index of the motionvector difference of the current block obtained from the bitstream. Thesyntax element obtainer 1710 according to an embodiment may determine amotion vector of the current block by using the distance of the motionvector difference, and may reconstruct the current block by using themotion vector of the current block.

Also, when a skip mode or a merge mode is used for the current block,the syntax element obtainer 1710 may extract, from the bitstream, theMMVD information indicating whether the MMVD mode is applied.

When the MMVD mode is used for the current block, the motion vectorcandidates may be set according to variable distance of the differenceand variable direction of the difference from the base motion vector.

The distance of the difference is a value determined based on a basepixel unit (for example, a ¼ pixel unit) and may indicate a differenceby base pixel units. For example, when the distance of the differencebetween the base motion vector and the motion vector is 1, the motionvector and the base motion vector are different by a pixel distancecorresponding to one ¼ pixel unit. The distance of the difference mayhave a value corresponding to an integer, a rational number, or anirrational number.

When a smallest pixel unit capable of being indicated by the motionvector of the current block is the same as the base pixel unit, thedecoder 1720 may determine motion vectors according to a predetermineddistance of a difference.

However, when the smallest pixel unit capable of being indicated by themotion vector of the current block is different from the base pixelunit, the decoder 1720 may scale the pre-determined distance of thedifference and then determine the motion vector candidate for the basemotion vector, based on the scaled distance of the difference.

When the motion vector of the current block is capable of indicatingpixels corresponding to an integer pixel unit, a ½ pixel unit, a ¼ pixelunit, and a ⅛ pixel unit, the smallest pixel unit capable of beingindicated by the motion vector of the current block is ⅛ pixel unit.Also, when the base pixel unit is a ¼ pixel unit, the decoder 1720 mayup-scale the distance of the difference for determining the motionvector.

According to an embodiment, the decoder 1720 may scale the distance ofthe difference according to a ratio of the base pixel unit to thesmallest pixel unit capable of being indicated by the motion vector ofthe current block.

According to an embodiment, the decoder 1720 may up-scale the distanceof the difference when the base pixel unit is greater than the smallestpixel unit capable of being indicated by the motion vector of thecurrent block.

According to an embodiment, the base motion vector of the current blockmay be determined from a merge candidate list used in the skip mode andthe merge mode. The merge candidate list may include adjacent blocksrelated to the current block spatially and temporally. The adjacentblocks related to the current block spatially and temporally may includea block decoded before the current block. Accordingly, the base motionvector according to an embodiment may be determined from a motion vectorof a adjacent block determined from the merge candidate list.

The adjacent block spatially related to the current block may include,for example, a block located left of the current block and a blocklocated top of the current block, but is not limited thereto. Also, theadjacent block related to the current block temporally may include, forexample, a block located at a same point as the current block from amongblocks included in a reference picture different from a current pictureincluding the current block, and a block spatially adjacent to the blockat the same point.

According to an embodiment, the decoder 1720 may determine motionvectors of the adjacent blocks related to the current block as the basemotion vector. The decoder 1720 may determine the base motion vector ina merge candidate list by using a merge index obtained from thebitstream. The merge index may be referred to as a merge index.

The merge index according to an embodiment may maximally indicate asecond candidate in the merge candidate list.

Alternatively, the decoder 1720 may modify the motion vectors of theadjacent blocks related to the current block and may determine themodified motion vectors as the base motion vector. According to anembodiment, the decoder 1720 may determine the base motion vector in asame manner as a method of determining a candidate list of motion vectorpredictors in an advanced motion vector prediction (AMVP) mode of thehigh efficiency video coding (HEVC) standard.

The merge index of the current block according to an embodiment may beencoded via a fixed length coding (FLC) method, a unary coding method,or a truncated unary coding method, and then may be included in thebitstream. For example, when the merge index is decoded via the FLCmethod, a cMax value may be 1.

When the base motion vector for the current block is determined, thedecoder 1720 may determine the motion vector by applying the base motionvector to the merge motion vector difference.

The syntax element obtainer 1710 may obtain, from the bitstream,information indicating at least one of a distance index of a differenceand a direction index of a difference, and the decoder 1720 maydetermine the merge motion vector difference, based on at least one ofthe distance index of the difference and the direction index of thedifference. The motion vector of the current block may be determinedfrom the base motion vector.

The syntax element obtainer 1710 according to an embodiment may decodethe distance index of the difference via the truncated unary codingmethod, and at this time, a cMax value may be 7 and a cRiceParam valuemay be 0. The syntax element obtainer 1710 according to an embodimentmay decode the direction index of the difference via the FLC method, andat this time, a cMax value may be 3 and a cRiceParam value may be 0.

The decoder 1720 according to an embodiment may scale the distance ofthe difference verified from the bitstream according to a ratio of thebase pixel unit to the smallest pixel unit capable of being indicated bythe motion vector of the current block. When the base pixel unit (forexample, a ¼ pixel unit) is greater than the smallest pixel unit (forexample, a ⅛ pixel unit) capable of being indicated by the motion vectorof the current block, the decoder 1720 may up-scale the distance of thedifference verified from the bitstream.

The scaled distance of the difference may indicate a difference bysmallest pixel units. For example, when the smallest pixel unit capableof being indicated by the motion vector of the current block is a ⅛pixel unit and the scaled distance of the difference is 2, the decoder1720 may determine the motion vector having a difference by a pixeldistance corresponding to two ⅛ pixel units from the base motion vector.

As described above, the distance of the difference pre-determined basedon the base pixel unit is used to determine the motion vector of thecurrent block based on the base motion vector determined from the mergecandidate list, and because information indicating the distance of thedifference based on the base pixel unit is signaled via the bitstream,the decoder 1720 of precision capable of indicating the smallest pixelunit, different from a precision of the base pixel unit, may scale thedistance of the difference signaled via the bitstream, according to thesmallest pixel unit.

The distance of the difference determined based on the base pixel unitand the distance of the difference scaled based on the smallest pixelunit may be the same with respect to a pixel distance.

According to an embodiment, information indicating the smallest pixelunit capable of being indicated by the motion vector of the currentblock may be included in the bitstream. The syntax element obtainer 1710may obtain the information indicating the smallest pixel unit from thebitstream corresponding to at least one level from among a block, aslice, and a picture.

At least one of the distance index of the difference and the directionindex of the difference for determining the motion vector of the currentblock may be obtained from the bitstream in a transform unit level, acoding unit level, a largest coding unit level, a slice level, or apicture level.

The syntax element obtainer 1710 according to an embodiment may obtainsome bins among the distance index of the difference by performingentropy decoding using context information (context variable) and mayobtain remaining bins by performing entropy decoding in a bypass mode.

By performing entropy decoding in a context adaptive binary arithmeticcoding (CABAC) manner on the bitstream, each bin of a syntax element maybe extracted and context information may be used for each bin. Decodingof a bypass mode may be performed, in which probability-based entropydecoding with equal probability of 0.5 is performed without using thecontext information. For entropy decoding of a current bin, it isdetermined whether the context information is used and which contextinformation is to be used.

The syntax element obtainer 1710 according to an embodiment may obtain afirst bin of the distance index of the merge motion vector difference byperforming entropy decoding using the context information on thebitstream. Also, the syntax element obtainer 1710 may obtain other binsof the distance index of the merge motion vector difference byperforming entropy decoding in the bypass mode on the bitstream

The syntax element obtainer 1710 according to an embodiment may performentropy decoding on the bitstream in the bypass mode to obtain a bin oftwo bits indicating the direction index of the difference.

The syntax element obtainer 1710 may obtain information indicating aresidual motion vector from the bitstream in the transform unit level,the coding unit level, the largest coding unit level, the slice level,or the picture level.

Motion vector candidates that may be determined from the base motionvector in the MMVD mode according to an embodiment will be describedbelow with reference to FIG. 21 .

FIG. 21 illustrates positions of motion vector candidates, according toan embodiment.

The decoder 1720 according to an embodiment may determine the motionvector of the current block by applying the merge motion vectordifference to the base motion vector. According to an embodiment, when aprediction direction of the current block is bi-direction, the mergemotion vector difference may be included in the bitstream only for oneuni-direction. For example, information indicating the merge motionvector difference may be included in the bitstream only for auni-direction of any one of a list 0 direction and a list 1 direction.

FIG. 21 illustrates motion vectors that may be determined in the MMVDmode in bi-directional prediction.

A base motion vector 2125 in an L0 direction and a base motion vector2135 in an L1 direction of a current block 2110 of a current picture2100 are determined in a merge candidate list. The base motion vector2125 in the L0 direction indicates a location of a broken line shape inan L0 reference picture 2120, and the base motion vector 2135 in the L1direction indicates a location of a broken line shape in an L1 referencepicture 2130.

However, in the MMVD mode, the motion vector difference may be appliedto each of the base motion vector 2125 and the base motion vector 2135in the L1 direction, based on the direction index of the difference andthe distance index of the difference.

For example, it may be determined whether a distance between a basemotion vector and a motion vector candidate is s, 2 s, 3 s, or the likeaccording to the distance index of the difference. When the distanceindex of the difference indicates s, a motion vector candidate generatedas a result of applying the motion vector difference to the base motionvector may indicate a location of a black circle among the L0 referencepicture 2120 and the L1 reference picture 2130. When the distance indexof the difference indicates 2 s, the motion vector candidate generatedas the result of applying the motion vector difference to the basemotion vector may indicate a location of a white circle among the L0reference picture 2120 and the L1 reference picture 2130.

For example, it may be determined whether a direction between the basemotion vector and the motion vector candidate is + or − in x and y axisdirections, according to the direction index of the difference. Inparticular, the direction index of the difference may indicate one of(+, 0), (−, 0), (0, +), and (0, −) in an (x,y) axis direction.

Accordingly, a motion vector indicating one location among the L0reference picture 2120 and the L1 reference picture 2130 may bedetermined by combining the distance index of the difference and thedirection index of the difference.

Hereinafter, with reference to FIG. 22 , a method of determining themotion vector candidates that may be determined from the base motionvector will be described. FIG. 22 is a diagram showing the motion vectorcandidates displayed on a coordinate plane, and illustrates the motionvector candidates determined according to the distance of the differencepre-determined based on the base pixel unit corresponding to a ¼ pixelunit.

Referring to FIG. 22 , the decoder 1720 may determine candidates locatedaccording to a predetermined shape with respect to configuring themotion vector candidates. The predetermined shape may be similar to apolygon such as a diamond or a rectangle, or a circle.

The decoder 1720 may determine candidates in a uniform distance of adifference from a point corresponding to the base motion vector as themotion vector candidates. The decoder 1720 may determine the motionvector candidates in a first distance of a difference from a pre-setpoint, determine the motion vector candidates in a second distance ofthe difference from the pre-set point, and may determine the motionvector candidates in an n-th distance of the difference from the pre-setpoint. The distance of the difference may be determined according to adefinition of a user. Alternatively, the decoder 1720 may directlydetermine the distance of the difference based on information related tothe current block, a temporal layer, or a group of pictures (GOP), orobtain, via the bitstream, information indicating the distance of thedifference for determining the motion vector candidates.

The decoder 1720 may determine the distance of the difference fordetermining the motion vector candidate of the current block accordingto a distance of a difference determined in a high level higher than alevel corresponding to the current block.

The number of motion vector candidates may be determined independentlyfor each distance of a difference. The decoder 1720 may determine thenumber of motion vector candidates for each distance of a difference ofthe current block, according to information about the number determinedin the high level higher than the level corresponding to the currentblock.

FIG. 22 illustrates a case in which the number of motion vectorcandidates in each distance of a difference is 4. Also, in FIG. 22 ,there are 3 distances of the difference, but the number of distances ofthe difference is not limited to 3.

Referring to FIG. 22 , the decoder 1720 may determine motion vectorcandidates having a distribution of a diamond shape based on a basemotion vector (x,y) 2201.

The decoder 1720 may determine motion vector candidates (x+1, y) 2202,(x−1, y) 2203, (x, y+1) 2204, and (x, y−1) 2205 in the distance of thedifference of 1 from the base motion vector (x,y) 2201.

The decoder 1720 may determine motion vector candidates (x+2, y) 2206,(x−2, y) 2207, (x, y+2) 2208, and (x, y−2) 2209 in the distance of thedifference of 2 from the base motion vector (x,y) 2201.

The decoder 1720 may determine motion vector candidates (x+4, y) 2210,(x−4, y) 2211, (x, y+4) 2212, and (x, y−4) 2213 in the distance of thedifference of 4 from the base motion vector (x,y) 2201.

According to an embodiment, the decoder 1720 may determine the motionvector candidates located in different distances of a difference foreach base motion vector. For example, from among a plurality of basemotion vectors, a motion vector candidate having a distance of adifference of 1 may be determined for a first base motion vector, and amotion vector candidate having a distance of a difference of 2 may bedetermined for a second base motion vector. Alternatively, for example,a motion vector candidate having a distance of a difference of 1 and amotion vector candidate having a distance of a difference of 2 may bedetermined for the first base motion vector, and a motion vectorcandidate having a distance of a difference of 4 and a motion vectorcandidate having a distance of a difference of 8 may be determined forthe second base motion vector.

When different distances of a difference are mapped to base motionvectors in an 1:1 manner, the syntax element obtainer 1710 may obtain,from the bitstream, only information indicating the base motion vectorof the current block or information indicating the distance of thedifference and determine the distance of the difference for specifyingthe motion vector of the current block and the base motion vector of thecurrent block.

As described above, the distance of the difference for determining themotion vector candidates may be determined based on the base pixel unit,and when the smallest pixel unit capable of being indicated by themotion vector of the current block is different from the base pixelunit, the decoder 1720 may scale the pre-set distance of the differencefor configuring a candidate group for each base motion vector.

When the motion vector of the current block is capable of indicatingpixels corresponding to an integer pixel unit, a ½ pixel unit, a ¼ pixelunit, and a ⅛ pixel unit, the smallest pixel unit capable of beingindicated by the motion vector of the current block is ⅛ pixel unit.Also, when the base pixel unit is a ¼ pixel unit, the decoder 1720 mayup-scale the distance of the difference. According to an embodiment, thedecoder 1720 may up-scale the distance of the difference according to aratio of the base pixel unit to the smallest pixel unit capable of beingindicated by the motion vector of the current block. When the smallestpixel unit capable of being indicated by the motion vector of thecurrent block is an m pixel unit, the base pixel unit is an n pixelunit, and the distance of the difference is k, the decoder 1720 mayup-scale the distance of the difference of k by k×n/m.

The syntax element obtainer 1710 according to an embodiment maydetermine the prediction mode of the current block to be one of the skipmode and the merge mode. In the skip mode or the merge mode, the decoder1720 according to an embodiment may generate a merge candidate listincluding adjacent blocks referred to in predicting the motion vector ofthe current block in the skip mode or the merge mode.

In the skip mode or the merge mode, the syntax element obtainer 1710 mayobtain MMVD information indicating whether a motion vector determinedfrom the merge candidate list of the current block and a merge motionvector difference are used. When the merge motion vector difference isused according to the MMVD information, prediction may be performedaccording to the MMVD mode in which the motion vector determined fromthe merge candidate list of the current block and the merge motionvector difference are used. When the merge motion vector difference isused according to the MMVD information, the syntax element obtainer 1710may obtain a merge index from the bitstream. The decoder 1720 accordingto an embodiment may determine the base motion vector from one candidatedetermined based on the merge index, in the merge candidate list. Thedecoder 1720 may determine the merge motion vector difference by usingthe distance index of the merge motion vector difference and thedirection index of the merge motion vector difference of the currentblock, and may determine the motion vector of the current block by usingthe base motion vector and the merge motion vector difference.

The decoder 1720 according to an embodiment may reconstruct the currentblock by using the motion vector of the current block. The decoder 1720may determine a reference block in a reference picture by using themotion vector of the current block, and may determine prediction samplescorresponding to the current block from among reference samples includedin the reference block.

When the prediction mode of the current block according to an embodimentis the merge mode and the MMVD mode is selected, the decoder 1720 maydetermine the base motion vector of the current block from the mergecandidate list and may determine the motion vector of the current blockby using the base motion vector and the merge motion vector difference.When the prediction mode of the current block is the merge mode, thevideo decoding apparatus 1700 may parse transform coefficients of thecurrent block from the bitstream and may obtain residual samples byperforming inverse quantization and inverse transformation on thetransform coefficients. The decoder 1720 may determine reconstructedsamples of the current block by combining the prediction samples of thecurrent block and the residual samples of the current block.

When the prediction mode of the current block according to an embodimentis the skip mode and the MMVD mode is selected, the decoder 1720 maydetermine the motion vector of the current block by using the mergemotion vector difference and the base motion vector determined from themerge candidate list. However, because the prediction mode of thecurrent block is the skip mode, the video decoding apparatus 1700 doesnot parse the transform coefficients of the current block from thebitstream and thus does not obtain the residual samples. In the skipmode, the decoder 1720 may determine the prediction samples of thecurrent block to be the reconstructed samples of the current blockwithout the residual samples.

Hereinafter, a video decoding method including performing interprediction in the MMVD mode will now be described with reference toFIGS. 18 to 36 .

FIG. 18 illustrates a flowchart of a video decoding method according toan embodiment.

In operation 1810, the syntax element obtainer 1710 may obtain, from asequence parameter set, sequence MMVD information indicating whether theMMVD mode is applicable in a current sequence.

In operation 1820, when the MMVD mode is applicable according to thesequence MMVD information, the syntax element obtainer 1710 may obtain,from a bitstream, first MMVD information indicating whether the MMVDmode is used for a current block included in the current sequence in afirst inter prediction mode.

In operation 1830, when the MMVD mode is applicable in the first interprediction mode according to the first MMVD information, the decoder1720 may reconstruct a motion vector of the current block which is to beused in the first inter prediction mode, by using a distance of a motionvector difference and a direction of the motion vector differenceobtained from the bitstream.

When a merge motion vector difference is used for the current blockaccording to MMVD information, the syntax element obtainer 1710 mayobtain a merge index from the bitstream. The merge index indicates onecandidate in a merge candidate list. The syntax element obtainer 1710may determine a base motion vector from the one candidate determinedbased on the merge index, in the merge candidate list.

The decoder 1720 may determine whether the MMVD mode is selected for thecurrent block based on the obtained MMVD information in a skip mode or amerge mode. When the MMVD mode is selected for the current block, i.e.,when the motion vector determined from the merge candidate list of thecurrent block and the merge motion vector difference are used, thesyntax element obtainer 1710 may obtain the merge index from thebitstream.

The merge index is information of 1 bit. Also, the merge index may beobtained by using one piece of context information for a first bin ofthe merge index. The syntax element obtainer 1710 may perform entropydecoding using context information to obtain the merge index in the skipmode or the merge mode.

The maximum number of candidates for which selection is allowedaccording to the merge index when the MMVD mode is selected in the skipmode or the merge mode may be smaller than the maximum number ofcandidates included in the merge candidate list. For example, becausethe merge index is a flag of 1 bit, the merge index may indicate onecandidate from among maximum two candidates in the merge candidate list.

The syntax element obtainer 1710 may obtain two bins indicating adirection index of the merge motion vector difference, by performingentropy decoding in a bypass mode on the bitstream. The syntax elementobtainer 1710 may obtain a first bin indicating the distance index ofthe merge motion vector difference by performing entropy decoding usingthe context information on the bitstream, and may obtain other binsindicating the distance index of the merge motion vector difference byperforming entropy decoding in the bypass mode.

In operation 1840, the decoder 1720 may reconstruct the current block byusing the motion vector of the current block.

The decoder 1720 may determine the merge motion vector difference of thecurrent block by using the distance index of the merge motion vectordifference of the current block and the direction index of the mergemotion vector difference, and may determine the motion vector of thecurrent block by using the base motion vector and the merge motionvector difference.

The decoder 1720 may determine a reference block in a reference pictureby using the motion vector of the current block, and may determineprediction samples corresponding to the current block from theprediction samples included in the reference block. The decoder 1720 mayadd the prediction samples of the current block and residual samples ofthe current block so as to determine reconstructed samples of thecurrent block in a prediction mode other than the skip mode. When theresidual samples are not available as in the skip mode, reconstructedsamples of the current block may be determined only from the predictionsamples of the current block.

In a general motion vector prediction mode (AMVP or advanced temporalmotion vector prediction (ATMVP)) that is neither skip mode nor themerge mode, the video decoding apparatus 1700 obtains a motion vectorpredictor index and a motion vector difference. The video decodingapparatus 1700 may determine a motion vector predictor indicated by themotion vector predictor index in a motion vector predictor list, anddetermine a motion vector by combining the motion vector predictor andmotion vector difference information.

Compared to the general motion vector prediction mode, the skip mode andthe merge mode do not use the motion vector difference. However, whenthe MMVD mode is selected in the skip mode or the merge mode, the mergemotion vector difference is used. Compared to the general motion vectorprediction mode, the merge motion vector difference in the MMVD mode hasexpression brevity compared to the motion vector difference.

For example, information required to represent a general motion vectordifference in an L0 prediction direction or an L1 prediction directionincludes information abs_mvd_greater0_flag indicating whether anabsolute value of the motion vector difference is greater than 0,information abs_mvd_greater1_flag indicating whether the absolute valueof the motion vector difference is greater than 1, informationabs_mvd_minus2 indicating a value obtained by subtracting 2 from theabsolute value of the motion vector difference, and informationmvd_sign_flag indicating a sign of the motion vector difference.

On the other hand, information required to represent the merge motionvector difference in the L0 prediction direction or the L1 predictiondirection is only information of a direction of a difference and adistance index of the difference. Accordingly, because the merge motionvector difference may be represented by using only the information ofthe direction of the difference and the distance index of thedifference, an amount of bits required to signal the merge motion vectordifference may be significantly decreased, compared to an amount of bitsrequired to signal the general motion vector difference.

FIG. 36 illustrates a flowchart of a video decoding method according toanother embodiment.

Operation 1810 is equal to that described above with reference to FIG.18 .

Operation 1822 and operation 1824 correspond to particular operations ofoperation 1820 of FIG. 18 . In operation 1822, when an MMVD mode isapplicable according to sequence MMVD information, the syntax elementobtainer 1710 may obtain sub-pixel MMVD information indicating whether amotion vector difference in an integer pixel unit is used or a motionvector difference in a sub-pixel unit is used in a current sequence.When the MMVD mode is not applicable according to the sequence MMVDinformation, both the motion vector difference in the integer pixel unitand the motion vector difference in the sub-pixel unit may not beapplicable in the current sequence and a current block.

In operation 1824, when the MMVD mode is applicable according to thesequence MMVD information, the syntax element obtainer 1710 may obtainMMVD information indicating whether the MMVD mode is used for thecurrent block included in the current sequence. That is, the MMVDinformation indicates whether the MMVD mode is applied when the currentblock is in a skip mode or a merge mode.

The syntax element obtainer 1710 may perform entropy decoding usingcontext information so as to obtain the MMVD information in the skipmode or the merge mode. When the MMVD information is obtained, operation1832 is performed.

Operation 1832 is a particular operation of operation 1830 of FIG. 18 .

In operation 1832, when the MMVD mode is enabled for the current blockaccording to the MMVD information, the decoder 1720 may determine,according to the sub-pixel MMVD information, whether the motion vectordifference in the integer pixel unit is used or the motion vectordifference in the sub-pixel unit is used in the current sequence, andmay reconstruct a distance of a motion vector difference in an integerpixel unit or a sub-pixel unit from a distance index of the motionvector difference of the current block obtained from a bitstream.

When the MMVD mode is used for the current block according to the MMVDinformation, and the motion vector difference in the integer pixel unitis used according to the sub-pixel MMVD information, the decoder 1720may reconstruct the distance of the motion vector difference in theinteger pixel unit from the distance index of the motion vectordifference of the current block.

Similarly, when the MMVD mode is used for the current block according tothe MMVD information, and the motion vector difference in the sub-pixelunit is used according to the sub-pixel MMVD information, the decoder1720 may reconstruct the distance of the motion vector difference in thesub-pixel unit from the distance index of the motion vector differenceof the current block.

When the reconstructed distance of the motion vector difference is inthe integer pixel unit, the decoder 1720 may round an x component valueand a y component value of a base motion vector of the current block tothe integer pixel unit, and may reconstruct the motion vector in theinteger pixel unit by using the x component value and the y componentvalue of the base motion vector which are rounded to the integer pixelunit.

When the reconstructed distance of the motion vector difference is inthe sub-pixel unit, the decoder 1720 may reconstruct a motion vector inthe sub-pixel unit by using the distance of the motion vector differencein the sub-pixel unit, and an x component value and a y component valueof a base motion vector which are rounded to the sub-pixel unit.

Therefore, when MMVD is applied in the current sequence, based on thesequence MMVD information obtained from a sequence parameter set (SPS),the video decoding apparatus 1700 may additionally obtain, from thebitstream, the sub-pixel MMVD information and the MMVD information.However, when MMVD is not applied in the current sequence, based on thesequence MMVD information, the video decoding apparatus 1700 does notneed to additionally parse, from the bitstream, both the sub-pixel MMVDinformation and the MMVD information. Because information indicatingwhether to apply MMVD is obtained by stages according to syntax levelssuch as the SPS, a coding unit syntax, and the like, a load of the videodecoding apparatus 1700 to decode a syntax element related to whether toapply the MMVD may be decreased.

The present VVC standard allows a resolution of a motion vector in a ¼pixel unit, a 1 pixel unit, or a 4 pixel unit. In this regard, precisionof a motion vector difference (MVD) is to be equal to precision of amotion vector predictor or a resolution of a motion vector. In thisregard, when precision of an integer pixel unit is used, precision ofthe motion vector may be rounded to the integer pixel unit, such thatencoding efficiency may be increased. However, rounding in a resolutionof a 1 pixel unit is performed for a resolution of a 4 pixel unit. Bydoing so, an interpolation procedure of a sub-pixel unit may bedecreased, and accuracy of the motion vector predictor may not be lost.When rounding is performed with respect to 4 pixels, accuracy of themotion vector predictor may deteriorate. Therefore, rounding in a 1pixel unit may be performed on a motion vector predictor whoseresolution is determined to be equal to or greater than 1 pixel.

An algorithm by which a motion vector is stored only in a particularpixel unit and then is reconstructed via a shift operation whennecessary. In this case, no matter how a pixel unit to be roundedaccording to a resolution of the motion vector is small, minimumrounding information has to be a resolution of a storage unit.

Hereinafter, a video encoding apparatus performing inter prediction byselecting a MMVD mode in a skip mode or a merge mode will now bedescribed with reference to FIG. 19 .

FIG. 19 is a block diagram of a video encoding apparatus according to anembodiment.

Referring to FIG. 19 , a video encoding apparatus 1900 according to anembodiment may include an inter prediction performer 1910, and a syntaxelement encoder 1920.

The video encoding apparatus 1900 may encode motion informationdetermined by performing inter prediction and may output the encodedmotion information in the form of a bitstream. The inter predictionperformer 1910 may determine various inter prediction information, andthe syntax element encoder 1920 may encode the inter predictioninformation in the form of syntax elements and may output a bitstream inthe form of a syntax that is a group of the syntax elements for eachcoding unit or each block.

The video encoding apparatus 1900 according to an embodiment may includea central processor (not shown) for controlling the inter predictionperformer 1910 and the syntax element encoder 1920. Alternatively, theinter prediction performer 1910 and the syntax element encoder 1920 mayoperate by their own processors (not shown), and the processors maysystematically operate with each other to operate the video encodingapparatus 1900. Alternatively, the inter prediction performer 1910 andthe syntax element encoder 1920 may be controlled according to controlby an external processor (not shown) of the video encoding apparatus1900.

The video encoding apparatus 1900 may include one or more data storages(not shown) storing input/output data of the inter prediction performer1910 and the syntax element encoder 1920. The video encoding apparatus1900 may include a memory controller (not shown) for controlling datainput and output of the data storage.

The video encoding apparatus 1900 may perform an image encodingoperation including prediction by connectively operating with aninternal video encoding processor or an external video encodingprocessor so as to encode an image. The internal video encodingprocessor of the video encoding apparatus 1900 according to anembodiment may perform a basic image encoding operation in a manner thatnot only a separate processor but also an image encoding processingmodule included in a central processing apparatus or a graphicprocessing apparatus perform the basic image encoding operation.

The inter prediction performer 1910 according to an embodiment maydetermine a motion vector of a current block by performing interprediction on the current block.

The inter prediction performer 1910 according to an embodiment maygenerate a merge candidate list including adjacent blocks referred to inprediction encoding the motion vector of the current block when interprediction is performed on the current block in one of a skip mode and amerge mode.

The syntax element encoder 1920 according to an embodiment may determinewhether to use a base motion vector determined in the merge candidatelist of the current block and a merge motion vector difference in a skipmode or a merge mode. When the merge motion vector difference is used,the syntax element encoder 1920 may generate a merge index, and mayperform entropy encoding on a bit string of the merge index. The mergeindex indicates the base motion vector in the merge candidate list.

The syntax element encoder 1920 may generate a distance index of themerge motion vector difference and a direction index of the merge motionvector difference corresponding to a difference between the base motionvector and a motion vector of the current block. The syntax elementencoder 1920 may perform entropy encoding on a bit string of thedistance index of the merge motion vector difference, and may performentropy encoding on the direction index of the merge motion vectordifference.

According to an embodiment, the MMVD mode may be applied to varioustools that are available in an inter prediction mode. Accordingly, thevideo encoding apparatus 1900 may encode information indicating whetherthe MMVD mode is applied to each tool of the inter prediction mode.

For example, in a first scheme, only information indicating whether theMMVD mode is applied to each tool may be encoded.

As another example, in a second scheme, information indicating whetherthe MMVD mode is applied to all tools may be first encoded, and ifapplicable, information indicating whether the MMVD mode is applied toeach tool may be encoded. When the MMVD mode is not applied to alltools, it is not necessary to encode information indicating whether theMMVD mode is applied to each tool.

In the first scheme, even when the MMVD mode is not applied to alltools, the video encoding apparatus 1900 has to encode a flag fordetermining that the MMVD mode is not applied to each of various tools.

However, according to the second scheme, when the MMVD mode is notenabled for all tools, the video encoding apparatus 1900 may encode onlya flag indicating that it is not applied to all tools, and may not needto additionally encode a flag indicating whether to apply the MMVD modeto each tool, such that encoding efficiency may be increased.

According to the second scheme, the syntax element encoder 1920 mayfirst encode sequence MMVD information indicating whether the MMVD modeis enabled for a current sequence. When the MMVD mode is applicable inthe current sequence, the syntax element encoder 1920 may determinewhether to encode a motion vector difference according to the MMVD modein a first inter prediction mode, and may determine whether to encode amotion vector difference according to the MMVD mode in a second interprediction mode. Accordingly, the syntax element encoder 1920 mayadditionally encode first MMVD information indicating whether the MMVDmode is applied in the first inter prediction mode and second MMVDinformation indicating whether the MMVD mode is applied in the secondinter prediction mode for the current block included in the currentsequence. However, when the MMVD mode is not applicable, the syntaxelement encoder 1920 according to an embodiment may encode only thesequence MMVD information and may not encode the first MMVD informationand the second MMVD information.

As a particular example of the second scheme, the syntax element encoder1920 may encode the sequence MMVD information indicating whether theMMVD mode is applicable in the current sequence. When the MMVD mode isapplicable, the syntax element encoder 1920 according to an embodimentmay encode sequence sub-pixel MMVD information indicating whether amotion vector difference in an integer pixel unit is used or a motionvector difference in a sub-pixel unit is used in the current sequence.When the MMVD mode is applicable, the syntax element encoder 1920according to an embodiment may encode MMVD information indicatingwhether the MMVD mode is used for the current block included in thecurrent sequence.

Hereinafter, an embodiment in which the video encoding apparatus 1900encodes the sequence MMVD information, the sequence sub-pixel MMVDinformation, and the MMVD information by stages according to the secondscheme will now be described with reference to FIGS. 20 and 37 .

FIG. 20 illustrates a flowchart of a video encoding method according toan embodiment.

In operation 2010, the syntax element encoder 1920 may encode thesequence MMVD information indicating whether the MMVD mode is applicablein a current sequence.

In operation 2020, when the MMVD mode is applicable in the currentsequence, the syntax element encoder 1920 may encode first MMVDinformation indicating whether the MMVD mode is used for a current blockin a first inter prediction mode.

In operation 2030, when the MMVD mode is applied in the first interprediction mode, the syntax element encoder 1920 may encode a distanceindex of a motion vector difference and a direction index of the motionvector difference of the current block.

The inter prediction performer 1910 may generate a merge candidate listincluding adjacent blocks referred to in predicting a motion vector ofthe current block when inter prediction is performed on the currentblock in one of a skip mode and a merge mode. The syntax element encoder1920 may generate MMVD information indicating whether a base motionvector determined from the merge candidate list of the current block anda merge motion vector difference are used.

When the merge motion vector difference is used, the syntax elementencoder 1920 may generate a merge index indicating one base motionvector in the merge candidate list. The syntax element encoder 1920 mayperform entropy encoding on a bit string of the merge index by using onepiece of context information.

The syntax element encoder 1920 may generate a distance index of themerge motion vector difference and a direction index of the merge motionvector difference corresponding to a difference between the base motionvector and the motion vector of the current block.

The inter prediction performer 1910 according to an embodiment maydetermine the motion vector of the current block, which indicates areference block in a reference picture.

The inter prediction performer 1910 according to an embodiment maydetermine the prediction mode of the motion vector of the current blockto be one of the skip mode and the merge mode. The syntax elementencoder 1920 may generate skip mode information indicating whether theprediction mode of the current block is the skip mode and merge modeinformation indicating whether the prediction mode is the merge mode.

When the prediction mode of the current block is the skip mode or themerge mode, the syntax element encoder 1920 may determine whether themotion vector of the current block is predicted in the MMVD mode usingthe merge motion vector difference and the base motion vector determinedfrom the merge candidate list of the current block. The syntax elementencoder 1920 may generate the MMVD information indicating whether themotion vector is predicted in the MMVD mode.

When motion information is predicted according to the MMVD mode, thesyntax element encoder 1920 according to an embodiment may determine themerge index indicating the base motion vector in the merge candidatelist. The syntax element encoder 1920 may perform entropy encodingapplying one piece of context information on the merge index to encodethe merge index indicating one candidate in the merge candidate list.

According to an embodiment, the number of candidates the merge index canindicate in the merge candidate list is maximally 2, and thus, the mergeindex may be information of 1 bit.

The syntax element encoder 1920 may determine the merge motion vectordifference between the motion vector of the current block and the basemotion vector, and may generate the distance index of the merge motionvector difference of the current block and the direction index of themerge motion vector difference.

When the prediction mode of the current block according to an embodimentis the merge mode and the MMVD mode is selected, the syntax elementencoder 1920 may generate the merge index indicating the base motionvector of the current block from the merge candidate list, and maygenerate information of the distance of the difference and informationof the direction of the difference for indicating the merge motionvector difference between the motion vector of the current block and thebase motion vector.

When the prediction mode of the current block is the merge mode, thevideo encoding apparatus 1900 may determine samples of the referenceblock indicated by the motion vector of the current block as theprediction samples of the current block. The video encoding apparatus1900 may determine the residual samples that are difference betweenoriginal samples and prediction samples of the current block. The videoencoding apparatus 1900 may encode the transform coefficients generatedby performing transformation and quantization on the residual samples ofthe current block.

According to an embodiment, when the prediction mode of the currentblock is the skip mode, the current block is encoded only with theprediction samples of the current block, and thus the video encodingapparatus 1900 does not encode the residual samples of the currentblock. Even when the prediction mode of the current block according toan embodiment is the skip mode and the MMVD mode is selected, the syntaxelement encoder 1920 may encode the MMVD information, the merge index,information of the distance of the difference, and information of thedirection of the difference, without encoding the residual samples.

When the motion vector is encoded in the MMVD mode, the syntax elementencoder 1920 may perform entropy encoding by applying one piece ofcontext information to the merge index. The merge index indicates onecandidate in the merge candidate list. The merge index according to anembodiment is information of 1 bit, and thus may be obtained by usingone piece of context information for a first bin.

The syntax element encoder 1920 may perform entropy encoding on thedistance index of the merge motion vector difference of the currentblock and the direction index of the merge motion vector difference.

The syntax element encoder 1920 according to an embodiment may performentropy encoding on two bins indicating the direction index of the mergemotion vector difference respectively via the bypass mode. The syntaxelement encoder 1920 may perform entropy encoding on a first binindicating the distance index of the merge motion vector difference byusing the context information, and may perform entropy encoding on otherbins indicating the distance index of the merge motion vector differencerespectively in the bypass mode.

FIG. 23 illustrates values and meanings of a merge index, distanceindices of a merge difference, and al direction indices of the mergedifference, according to an embodiment.

The direction index of the merge difference indicates a distance indexof a merge motion vector difference. The direction index of the mergedifference indicates a direction index of the merge motion vectordifference.

The video decoding apparatus 1700 may determine a motion vector of acurrent block based on the merge index, the direction index of the mergedifference, and the direction index of the merge difference.

Table 2600 of FIG. 23 illustrates the merge index according to anembodiment and a motion vector candidate corresponding thereto. A mergecandidate list according to an embodiment includes four motion vectorcandidates (1^(st) 2^(nd), 3^(rd), and 4^(th) MV candidates) and themerge index may be displayed in an index (0, 1, 2, or 3) indicating oneof them.

In a MMVD mode, one motion vector candidate indicated by the merge indexamong the merge candidate list may be determined to be a base motionvector.

In Table 2610 of FIG. 23 , the direction index of the merge differenceaccording to an embodiment is an integer among 0 to 7, and each indexmay be binarized according to a truncated unary coding method. Thedirection index of the merge difference may indicate one of 2N, whereinN is 0 to 7. A distance of the merge difference is determined based on abase pixel unit, and when the base pixel unit is ¼, a distance of amerge motion vector difference corresponding to the direction index ofthe merge difference 0 may denote a ¼ pixel distance and a distance of amerge motion vector difference corresponding to the direction index ofthe merge difference 1 may denote a ½ pixel distance. A distance of amerge motion vector difference corresponding to the direction index ofthe merge difference 7 may denote a 32 pixel distance.

As described above, when a smallest pixel unit capable of beingindicated by the motion vector of the current block is smaller than thebase pixel unit, the distance of the merge motion vector difference maybe scaled according to a ratio of the smallest pixel unit to the basepixel unit. For example, when the base pixel unit is ¼ pixel unit andthe smallest pixel unit is ⅛ pixel unit, and when an index indicatingthe distance of the merge motion vector difference obtained from abitstream is 0, a distance of a merge motion vector difference 1corresponding to the index 0 may be up-scaled to 2.

Also, in Table 2620, a direction index of a merge motion vectordifference of a bin string 00 denotes a motion vector candidate changedalong a + direction in an X axis based on the base motion vector, and adirection of a merge motion vector difference of a bin string 11 denotesa motion vector candidate changed along a − direction in a Y axis basedon the base motion vector.

The merge index, the direction index of the merge difference, and thedirection index of the merge difference of FIG. 23 are only examples andindices available in the MMVD mode proposed in the disclosure are notlimited thereto.

For example, the number of candidates that can be selected from themerge candidate list in the MMVD mode may be limited to 2, and the mergeindex may be an index of 1 bit.

FIG. 24 illustrates equations for obtaining a motion vector by using abase motion vector and a merge motion vector difference, according to anembodiment.

mvLX[x][y][n] denotes a motion vector of a current block. x, y denotesx, y coordinates of the current block, and n denotes one of a horizontaldirection component and a vertical direction component of a motionvector mvLX. mvLX[x][y][0] denotes the horizontal direction component ofthe motion vector mvLX and mvLX[x][y][1] denotes the vertical directioncomponent of the motion vector mvLX.

mxLXN[m] denotes a base motion vector indicated by a merge index in themerge candidate list. m denotes one of a horizontal direction componentand a vertical direction component of a base motion vector mvLXN.mvLXN[0] denotes the horizontal direction component of the base motionvector mvLXN and mvLXN[1] denotes the vertical direction component ofthe base motion vector mvLXN.

refineMxLX[1] denotes a merge motion vector difference. 1 denotes one ofa horizontal direction component and a vertical direction component of amerge motion vector difference refineMxLX. refineMxLX[0] denotes thehorizontal direction component of the merge motion vector differencerefineMxLX and refineMxLX[1] denotes the vertical direction component ofthe merge motion vector difference refineMxLX.

In mvLX, mxLXN, and refineMxLX, LX denotes one of an L0 predictiondirection and an L1 prediction direction. Accordingly, mvL0, mxL0N, andrefineMxL0 denote the motion vector, the base motion vector, and themerge motion vector difference in the L0 prediction direction, and mvL1,mxL1N, and refineMxL1 denote the motion vector, the base motion vector,and the merge motion vector difference in the L1 prediction direction.

The video decoding apparatus 1700 according to an embodiment obtains themerge index from a bitstream, and determines the horizontal directioncomponent mxLXN[ ] of the base motion vector indicated by the mergeindex from the merge candidate list and the vertical direction componentmxLXN[ ] of the base motion vector.

The video decoding apparatus 1700 according to an embodiment obtains adirection index of a merge difference and a distance index of a mergedifference from the bitstream, and determines the horizontal directioncomponent refineMxLX[0] of the merge motion vector difference and thevertical direction component refineMxLX[1] of the merge motion vectordifference by using the direction index of the merge difference and thedistance index of the merge difference.

The video decoding apparatus 1700 according to an embodiment may obtainthe horizontal direction component mvLX[0][0][0] of the motion vector ofthe current block by adding the horizontal direction component mxLXN[ ]of the base motion vector and the horizontal direction componentrefineMxLX[0] of the merge motion vector difference, and may obtain thevertical direction component mvLX[0][0][1] of the motion vector of thecurrent block by adding the vertical direction component mxLXN[1] of thebase motion vector and the vertical direction component refineMxLX[1] ofthe merge motion vector difference.

FIG. 37 illustrates a flowchart of a video encoding method according toanother embodiment.

Operation 2010 is equal to that described above with reference tooperation 2010 of FIG. 20 .

Operations 2022 and 2024 correspond to particular operations ofoperation 2020 of FIG. 20 .

In operation 2022, the inter prediction performer 1910 may determinewhether to apply an MMVD mode in a current sequence. Accordingly, thesyntax element encoder 1920 may encode sequence MMVD informationindicating whether the MMVD mode is applicable in the current sequence.

In operation 2022, when the MMVD mode is applicable, the interprediction performer 1910 may determine whether a motion vectordifference in an integer pixel unit is used or a motion vectordifference in a sub-pixel unit is used in the current sequence.Accordingly, when the MMVD mode is applicable, the syntax elementencoder 1920 may encode sub-pixel MMVD information indicating whetherthe motion vector difference in the integer pixel unit is used or themotion vector difference in the sub-pixel unit is used in the currentsequence.

In operation 2024, when the MMVD mode is applicable, the interprediction performer 1910 may determine whether the MMVD mode is usedfor a current block included in the current sequence. Accordingly, whenthe MMVD mode is applicable, the syntax element encoder 1920 may encodeMMVD information indicating whether the MMVD mode is used for thecurrent block included in the current sequence.

Operation 2032 is a particular operation of operation 2030 of FIG. 20 .In operation 2032, when the MMVD mode is used for the current block, thesyntax element encoder 1920 may encode a distance index of a motionvector difference of the current block which is determined according toa distance of a motion vector difference in an integer pixel unit or asub-pixel unit.

When the MMVD mode is used for the current block and the motion vectordifference in the integer pixel unit is used, the syntax element encoder1920 may determine and encode the distance index of the motion vectordifference of the current block, based on the distance of the motionvector difference in the integer pixel unit.

When the MMVD mode is used for the current block and the motion vectordifference in the sub-pixel unit is used, the syntax element encoder1920 may determine and encode the distance index of the motion vectordifference of the current block, based on the distance of the motionvector difference in the sub-pixel unit.

When the MMVD mode is not applicable, the syntax element encoder 1920may not encode the sub-pixel MMVD information and the MMVD information.

When the distance of the motion vector difference is encoded in theinteger pixel unit, the syntax element encoder 1920 may round an xcomponent value and a y component value of a base motion vector of thecurrent block in the integer pixel unit, and may determine the distanceof the motion vector difference in the integer pixel unit by using the xcomponent value and the y component value of the base motion vectorwhich are rounded to the integer pixel unit. Accordingly, the syntaxelement encoder 1920 may encode the distance index corresponding to thedistance of the motion vector difference in the integer pixel unit.

When the distance of the motion vector difference is encoded in thesub-pixel unit, the syntax element encoder 1920 may round an x componentvalue and a y component value of a base motion vector of the currentblock in the sub-pixel unit, and may determine the distance of themotion vector difference in the sub-pixel unit by using the x componentvalue and the y component value of the base motion vector which arerounded to the sub-pixel unit. Accordingly, the syntax element encoder1920 may encode the distance index corresponding to the distance of themotion vector difference in the sub-pixel unit.

Therefore, when MMVD is applied in the current sequence, the videoencoding apparatus 1900 may encode not only the sequence MMVDinformation but also additionally encode the sub-pixel MMVD informationand the MMVD information. However, when MMVD is not applied in thecurrent sequence, the video decoding apparatus 1700 may encode only thesequence MMVD information and may not need to additionally encode boththe sub-pixel MMVD information and the MMVD information. Becauseinformation indicating whether to apply MMVD is encoded by stagesaccording to syntax levels such as a SPS, a coding unit syntax, and thelike, a load of the video encoding apparatus 1900 to encode a syntaxelement related to whether to apply the MMVD may be decreased.

The video decoding apparatus 1700 and the video encoding apparatus 1900according to an embodiment may signal a distance index of a motionvector difference, instead of a size of a motion vector, in the MMVDmode. Also, instead of sign information indicating a direction of themotion vector, a direction index of a merge motion vector difference maybe signaled in the MMVD mode.

The distance index of the motion vector difference may be representedbased on precision of a motion vector which is used in a video codecembedded in the video decoding apparatus 1700 and the video encodingapparatus 1900. For example, in a versatile video coding (VVC) codec, a1/16 pixel unit is internally used as an MV. However, precisionindicating a motion vector is represented as ¼. Therefore, when adistance index of the MMVD mode is 1, variation of a motion vector isexpressed with precision of ¼. When a distance index of the MMVD mode is2, variation of a motion vector is expressed with precision of ½. Aplurality of motion vector precisions may be expressed using distanceindices, and a direction of a motion vector may be expressed as adirection index of a merge motion vector difference.

The merge motion vector difference may be added to a motion vectorpredictor corresponding to a base motion vector which is selected in amerge candidate list. Because a distance index expresses precision of amotion vector, a motion vector predictor has to be rounded with sameprecision such that precision of a final motion vector may match withprecision of the distance index.

Predictor (value rounded with information of distance index)+mergemotion vector difference (distance index*preset precision)*directionindex

Precision of a merge motion vector difference may be applied to an interprediction mode used by a current motion vector. A motion vectorprecision concept according to a distance index of a merge motion vectordifference may be applied to a motion vector predictor of an interprediction mode including a skip mode, a merge mode, an affine skipmode, an affine merge mode, an inter/intra combination mode, ageneralized B mode, a triangular partition mode, an AMVP mode, anadaptive motion vector resolution (AMVR) mode, an affine AMVP mode, orthe like which are available in a current video codec. Also, the motionvector precision concept according to the distance index of the mergemotion vector difference may be applied to a motion vector differencecomponent (including a first mvd component, a second mvd component, . .. , an N^(th) mvd component) in each inter prediction mode. Therefore,various indices used in each inter prediction mode may be interpretedand used as motion vector precision corresponding thereto.

Hereinafter, with reference to FIGS. 25 and 26 , a method of matching adistance of a merge difference with precision of a motion vector or amotion vector predictor will now be described.

FIG. 25 illustrates equations for adjusting precision of a motion vectorpredictor or a base motion vector when precision of a distance index ofa merge difference is 64 according to an embodiment. FIG. 26 illustratesequations for adjusting precision of a motion vector predictor or a basemotion vector when precision of a distance index of a merge differenceis 16 according to an embodiment.

An MMVD mode refers to a scheme of expressing a motion vector differenceas a log exponent. For example, precision of a motion vector or a pixellocation may be selected to be ¼, ½, 1, 2, 4, 8, 16, or 32. When amotion vector difference is expressed in an integer pixel unit in theMMVD mode, a motion vector predictor is also set in an integer pixelunit, such that precision of the motion vector difference and precisionof the motion vector predictor may be set to be equal in the MMVD mode.By allowing the precision of the motion vector difference and theprecision of the motion vector predictor to be equal, an interpolationfiltering process for motion compensation may be skipped, and by doingso, a data bus bandwidth for accessing an external memory is decreased,such that encoding/decoding efficiency may be increased.

For a particular example, precision of a motion vector in FIGS. 25 and26 is 1/16. When the precision of the motion vector is 1/16 and adistance of a motion vector difference is 64, the distance of the motionvector difference may be 4 pixels in an integer pixel unit.

In FIG. 25 , to round x and y components of actual MVP (a motion vectorpredictor or a base motion vector) in a 4 pixel unit according to thedistance of the motion vector difference, the x component and the ycomponent of MVP may be rounded off to 64. MVP[0] indicates the xcomponent of MVP, and MVP[1] indicates the y component of MVP.

In FIG. 26 , when MVP is always rounded to an integer pixel unit,because the precision of the motion vector is 1/16, the x component andthe y component of MVP may be rounded off to 16.

A flag representing information indicating whether to apply the MMVDmode used in a skip mode or a merge mode, and information indicatingwhether to apply the MMVD mode used in other prediction methods may beused in high-level syntax.

Because the MMVD mode is a method for transmitting a motion vector, theMMVD mode may be used in all inter prediction technologies transmittinga motion vector difference and intra prediction technologies (e.g., acurrent picture referencing (CRP) technology) using a motion vector.Enable flags for indicating whether the MMVD mode is applicable inrespective prediction technologies may be included in high-level syntax.

As another example, to represent a flag of the MMVD mode for otherprediction technologies such as an MMVD mode to be applied to an affinecontrol point, an MMVD mode to be applied to a sub-block mode, an MMVDmode to be applied to a triangular partition prediction technique, anMMVD mode to be applied to an intra/inter combination prediction mode,or the like, an MMVD flag in the skip mode and an MMVD flag in the mergemode may be used. That is, all prediction techniques using the MMVD modein high-level syntax may be simultaneously controlled by onerepresentative MMVD enable flag. When an MMVD enable flag is 1, the MMVDmode can be used in all prediction techniques, and when the MMVD enableflag is 0, the MMVD mode cannot be used in all prediction techniques.

As another example, one representative flag may be signaled, andparticular flags may be conditionally signaled. When there is one toolto which the MMVD mode is used, the video encoding apparatus 1900 mayfirst transmit mmvd_enalble_flag that is a representative flag inhigh-level syntax. When mmvd_enalble_flag is 1, the video decodingapparatus 1700 may sequentially parse flags indicating whether the MMVDmode is applied in other inter prediction techniques and then maydetermine whether the MMVD mode is applied to each of other interprediction techniques.

For example, in a case where the MMVD mode is applied to an affinetechnique, when an MMVD enable flag that is a representative flag is 1,it may be interpreted that the MMVD mode to be applied to an affinecontrol point (CP) has been used.

As another example, when it is confirmed that the MMVD enable flag thatis the representative flag is 1, it may mean that the MMVD mode has beenused in a certain inter prediction technique. In addition, the videodecoding apparatus 1700 may parse flags of the MMVD mode for respectiveparticular inter prediction techniques, thereby determining whether theMMVD mode has been used in each inter prediction technique. Suchsyntaxes for respective techniques may have a parsing relation that isdependent on representative mmvd enable flag, and parsing relationsbetween syntaxes for respective techniques may be parallel.

The MMVD mode includes two modes that are the MMVD mode of a skip modeand the MMVD mode of a merge mode. The video decoding apparatus 1700 andthe video encoding apparatus 1900 according to an embodiment maydetermine whether it is the skip mode, by signaling a skip mode flag ofa current block, and then may determine whether it is both the skip modeand the MMVD mode, by signaling an MMVD flag. Also, when it is not theskip mode, the video decoding apparatus 1700 and the video encodingapparatus 1900 may determine whether it is the merge mode, by signalinga merge mode flag, and then may determine whether it is both the mergemode and the MMVD mode, by signaling the MMVD flag. The video decodingapparatus 1700 may indirectly identify existence or non-existence ofresidual, according to which flag from among the skip mode flag and themerge mode flag the MMVD flag is signaled thereafter. That is, when theMMVD flag is signaled after the skip mode flag, residual does not exist,but, when the MMVD flag is signaled after the merge mode flag, residualmay exist.

In a different example, hereinafter, the MMVD mode may be usedindependently from the skip mode and the merge mode. An embodiment willnow be described, in which, when the video decoding apparatus 1700 andthe video encoding apparatus 1900 according to an embodiment use anindependent MMVD flag, separate information indicating whether to useresidual is signaled.

The video encoding apparatus 1900 according to an embodiment maygenerate, after an MMVD flag, and transmit a syntax element aboutwhether to use residual. For example, when the MMVD flag is 1, a flag(e.g., no_residue_flag) for determining whether or not to transmitresidual of a current block may be separately transmitted thereafter.When no_residue_flag is 1, the video decoding apparatus 1700 maydetermine that the MMVD flag is 1 in the skip mode, and may performdecoding without residual. When no_residue_flag is 0, the video decodingapparatus 1700 may determine that the MMVD flag is 1 in the merge mode,may additionally parse residual, and then may perform decoding.

As another example, whether residual of respective color components thatare Y, Cb, Cr components exist as in an advanced motion vectorprediction (AMVP) mode of the HEVC standard is checked through cbf, andresidual may be parsed according to a result of the checking. Forexample, whether residuals with respect to respective components thatare Y, Cb, Cr components exist may be determined by signaling cbf of acoding unit (cu_cbf), cbf of a transform unit of a Y component(tu_cbf_luma), cbf of a transform unit of a Cb component (tu_cbf_cb),cbf of a transform unit of a Cr component (tu_cbf_cr), and the like. Asanother example, a flag indicating whether residual exists in all of Y,Cb, Cr components may be signaled.

As another example, the MMVD mode may not be allowed for the skip modebut may be allowed only for the merge mode. Because motion informationis predicted in a normal merge mode in a same manner as the skip mode,it is possible to assume that residual always exists in the merge mode.That is, in the HEVC standard, it is assumed that root_cbf is always 1and thus residual exists in at least one component from among Y, Cb, Crcomponents. After root_cbf, flags indicating whether residual exists maybe respectively signaled for components (Y, Cb, Cr). However, when theMMVD mode is allowed only in the merge mode, even when residual does notexist in the MMVD mode, a flag for indicating whether residual exist maybe signaled for each of Y, Cb, Cr. In this case, although the MMVD modeis of the merge mode, when residual does not exist in a current block,root_cbf may be signaled to determine existence or non-existence ofresidual by using one root_cbf.

Also, in the current VVC standard, a mode in which intra prediction andinter prediction are combined to generate prediction data, or atriangular partition prediction mode in which prediction is performed byallowing a partition connecting vertexes of a diagonal line of a blockmay be allowed only for the merge mode. Similar to the method proposedabove, although the MMVD mode is of the merge mode, when residual doesnot exist in a current block, root_cbf may be signaled to determineexistence or non-existence of residual by using one root_cbf.

FIG. 27 illustrates reference table for determining binarization of aplurality of pieces of merge-related information according to anembodiment.

For example, binarization of syntax element mmvd_merge_flag indicatingwhether it is predicted in an MMVD mode is fixed-length binarization(FL), and in this regard, cMax parameter value is 1. Binarization ofmmvd_cand_flag corresponding to a merge index is also FL, and in thisregard, cMax parameter value may be 1.

Binarization of syntax element mmvd_distance_idx corresponding to adistance index of a merge motion vector difference is truncated Ricebinarization (TR), and in this regard, cMax parameter value may be 7,and cRiceParam value may be 0. Binarization of syntax elementmmvd_direction_idx corresponding to a direction index of the mergemotion vector difference is FL, and in this regard, cMax parameter valuemay be 3.

Hereinafter, with reference to FIGS. 28 to 33 , various binarizationsfor a plurality of pieces of MMVD-related information will now bedescribed.

FIG. 28 illustrates comparison table of bin strings of 8 distanceindices (mmvd) of a merge difference according to various binarizations.

A distance index (mmvd) of a merge difference may be mapped to a valueindicating a particular distance of a motion vector difference in anMMVD mode. For example, indices 0, 1, 2, 3, 4, 5, 6, and 7 may berespectively mapped to 4, 8, 16, 32, 64, 128, 256, and 512 of distancesof a motion vector difference. As another example, indices 0, 1, 2, 3,4, 5, 6, and 7 may be respectively mapped to 1, 2, 4, 8, 16, 32, 64, and128 of distances of a motion vector difference.

Comparison table of FIG. 28 shows bin strings corresponding to distanceindices according to binarization 1 and binarization 2 when the numberof distance indices of a merge motion vector difference is from 0 to 7,i.e., 8.

Binarization 1 is a truncated unary coding scheme in which a length of abin string corresponding to an index becomes short as the index becomessmaller. This scheme is useful binarization, assuming that, as an indexbecomes small, a distance of a motion vector difference correspondingthereto most frequently occurs. However, it is not true that a distanceof a motion vector difference corresponding to a first index of 0according to a characteristic and a resolution of an image mostfrequently occurs.

Even when a first index does not correspond to a distance of a motionvector difference that most frequently occurs, it is true that a smallindex corresponds to a distance of a motion vector difference that mostfrequently occurs. Based on the fact described above, according tobinarization 2, the video encoding apparatus 1900 allocates a bin stringof 2 bits to distance indices of 0, 1, and 2, and allocates a bin stringof a smaller number of bits to distance indices of 3, 4, 5, 6, and 7,compared to binarization 1. Therefore, compared to binarization 1,according to binarization 2, an effect in which a probability that adistance index of a motion vector difference occurs and the number ofbits of a bin string corresponding thereto are thoroughly and evenlycorrected may be expected.

In an additional embodiment, the video encoding apparatus 1900 maydetermine a bin string corresponding to a distance index, according toan actual occurrence probability of a distance index of a motion vectordifference in a real natural image. Variable length coding (VLC) codingby which, when an occurrence probability of a particular distance indexof a motion vector difference is equal to or greater than 50%, a binstring of 1 bit is allocated to a distance index corresponding to thedistance of the difference may be used. However, when an occurrenceprobability of a distance of a motion vector difference is overallsmaller than 50%, a bin string corresponding to a distance index of amotion vector difference may be determined, according to binarization 2.

The video decoding apparatus 1700 may perform inverse binarization on adistance index of a motion vector difference according to binarizationselected by the video encoding apparatus 1900. That is, the videodecoding apparatus 1700 may parse, from a bitstream, a bin string of thedistance index of the motion vector difference, and may determine thedistance index of the motion vector difference corresponding to the binstring, according to binarization selected by the video encodingapparatus 1900.

The video encoding apparatus 1900 according to an embodiment maydetermine a distance index of a motion vector difference, according tok-th order exp-golomb binarization.

FIG. 29 illustrates an embodiment of k-th order exp-golomb binarization.

k-th order exp-golomb binarization refers to a scheme for varyingprobability-based bit expression according to an exponent of k. Comparedto binarization 2, k-th order exp-golomb binarization may further even alength of a bin string according to an occurrence probability of adistance of a motion vector difference.

As illustrated in FIG. 29 , it may be defined that a length of a bitstring corresponding to distance indices of 0 and 1 is 2, a length of abit string corresponding to distance indices of 2, 3, and 4 is 3, alength of a bit string corresponding to a distance index of 5 is 4, anda length of a bit string corresponding to distance indices of 6 and 7 is5. When k-exponent is changed, bin strings allocated to respectivedistance indices may be changed.

In another embodiment, a bin string of a distance index of a motionvector difference of MMVD may be determined according to a truncatedrice (TR) binarization process. For example, a variable cMax may be setto 7 and cRiceParam may be set to 7, which are required in the TRbinarization process, or cMax may be set to 7 and cRiceParam may be setto 1.

In another embodiment, in a current sequence, a current picture, acurrent slice, a current tile, or a current largest coding unit, i.e.,in each data level, according to an occurrence probability of thedistance index of the motion vector difference, cRiceParam of the TRbinarization process may be variably set. As cRiceParam becomes large,it is possible to allocate bits with a uniform probability, such thatcRiceParam may be separately set in a corresponding level and signaled.cRiceParam information used in each data level may be signaled throughheader information of a corresponding data level.

In a more specific example, binarization may be variably changed basedon an occurrence probability of a distance index of an MMVD motionvector difference in each data level. Also, binarization may not belimited to the TR binarization process but may be changed basedbinarization table of a preset VLC scheme or FLC scheme according tovarious occurrence probabilities.

As another example, coding efficiency may be increased by variablychanging a maximum value of a distance index of an MMVD motion vectorwhich is used in every sequence, every picture, every slice, every tile,or every CTU. For example, when the TR binarization process is used,cMax value may be changed. To use 6 distance indices, cMax value may bechanged to 5. Number information with respect to cMax may be included inheader information of a current data level. Also, cMax may be variablychanged according to an occurrence probability of a distance index in acorresponding data level.

In another embodiment, regardless of binarization being used when adistance index of a motion vector difference of an MMVD mode isbinarized, entropy encoding to which a context model is applied may beperformed on a first bit of a bin string corresponding to the distanceindex. It is because, when symbols are grouped according toprobabilities in binarization where a symbol and a bin string arematched, a first bit of a bin string represents primary classificationby which each symbol group is identified. Therefore, when a contextmodel is applied to a first bit of a bin string, further increasedentropy encoding efficiency may be expected.

According to binarization, a context model may be applied to a secondbit. In addition, when an occurrence probability of a plurality ofparticular distance indices is high, entropy encoding efficiency may beincreased by applying binarization using context. For example, when anoccurrence probability of distance indices of 0 and 1 is high inbinarization 1 and binarization 2 described above, entropy codingefficiency may be increased by applying binarization using context to afirst bit and a second bit.

For example, in a case where binarization using context is used, when afirst bit of a bin string is 0, a distance index corresponding theretomay be 0 or 1, and when the first bit of the bin string is 1, othersexcluding 0 and 1 may be distance indices.

In another example, only when the first bit is 1, a context model may beapplied to a second bit immediately thereafter. It is because the secondbit may be classified with a particular probability in a second group (agroup in which the first bit is 1). Therefore, in a case where the firstbit is 1, when the context model is applied to the second bit, entropycoding efficiency may be further increased.

FIG. 30 illustrates comparison table of a bin string of 6 distanceindices of a merge difference according to various binarizations.

Similar to FIG. 28 , it may be defined that a length of a bit stringcorresponding to distance indices of 0, 1, and 2 is 2, a length of a bitstring corresponding to a distance index of 3 is 3, and a length of abit string corresponding to distance indices of 4 and 5 is 4.

FIG. 31 illustrates bin strings that are generated by varyingbinarization according to groups of distance indices of a mergedifference according to an embodiment.

FIG. 31 illustrates bin strings according to binarization 1 andbinarization 2 when the number of distance indices of a motion vectordifference of an MMVD mode is N. A distance index may be mapped to aparticular distance value of a motion vector. For example, the distanceindex may be mapped to cases where sizes of a distance of a motionvector difference are 4, 8, 16, 32, 64, 128, 256, and 512. As anotherexample, the distance index may be mapped to 1, 2, 4, 8, 16, 32, 64, and128 that are sizes of the distance of the motion vector difference.

According to binarization 1, truncated unary coding (T-unary coding) maybe used to express a distance index.

On the contrary thereto, to increase entropy encoding efficiency, inbinarizations 2 and 3, one syntax element is added to every separatedistance index. The syntax element is a flag used in groupingcorresponding distance indices so as to perform coding with minimum bitsby separately grouping most probable distance indices.

A distance index group refers to a group of distance indices having ahigh selection probability and includes indices that are most frequentlyselected from a given distance index list. Therefore, the flag may bedetermined based on flags accumulated by a distance index group ofblocks that are already encoded in a current frame or a slice. Inanother example, a flag of a current block may be determined by using acorresponding flag of an adjacent block encoded in the MMVD mode.

Information about which distance index in a distance index group is tobe used may be signaled through high-level syntax, and a distance indexselected based on the information may be used in a picture, a tile, aslice, and the like that are lower than high-level syntax.

According to binarization 2, when it is assumed that first distanceindices 0 and 1 are most probable candidates, a distance index group 0including distance indices 0 and 1 may be determined. A group 1including other distance indices may be determined. A group flag of 0may be allocated to the group 0, and a group flag of 1 may be allocatedto the group 1. In general, the number of indices included in the group1 may be determined by subtracting the number of indices included in thegroup 0 from the maximum number of distance indices. For example, anumber obtained by subtracting 2 that is the number of indices of thegroup 0 from N+1 that is the maximum number of distance indices may bethe number of indices of the group 1.

A context model may be applied to a group flag. Because selectabledistance indices are included in the group 0, entropy encodingefficiency may be improved by using the context model.

Indices included in the group 0 may be encoded using FLC, and indicesincluded in the group 1 may be arranged from the smallest and then maybe encoded using T-unary coding.

According to binarization 3, a group 0 including distance indices of 0,1, 2, and 3 is determined, assuming that first distance indices of 0, 1,2, and 3 are most probable candidates. A group 1 including otherdistance indices is determined. In general, the number of indicesincluded in the group 1 may be determined by subtracting the number ofindices included in the group 0 from the maximum number of distanceindices.

A context model may be applied to a group flag. Indices included in thegroup 0 may be encoded using FLC, and indices included in the group 1may be arranged from the smallest and then may be encoded using T-unarycoding.

In binarizations 2 and 3 described with reference to FIG. 31 , thedistance indices included in the group 0 are not always encoded usingFLC and the distance indices included in the group 1 are not alwaysencoded using T-unary coding. Some indices included in the group 0 maybe encoded using FLC, and other indices may be encoded using T-unarycoding. Similarly, some indices included in the group 1 may be encodedusing FLC, and other indices may be encoded using T-unary coding.

Hereinafter, with reference to FIGS. 32 and 33 , binarization in whichcodeword is differently allocated based on precision of a distance of amotion vector difference.

FIG. 32 illustrates codewords of cases of 8 distance indices (mmvd) of amerge difference according to an embodiment. FIG. 33 illustratescodewords of cases of 6 distance indices (mmvd) of a merge differenceaccording to an embodiment.

A distance offset of a motion vector difference may only be a numberexpressed as powers of 2 (2{circumflex over ( )}n, where n is aninteger). According to whether the distance offset refers to precisionin a sub-pixel unit or precision in an integer pixel unit, codeword withrespect to a distance index may be allocated. For example, referring toFIG. 32 , a total number of distances of a motion vector difference maybe 8, and values thereof may be ¼, ½, 1, 2, 4, 8, 16, and 32. Distanceoffsets of ¼ and ½ in sub-pixel units may be determined to be one group,and other distance offsets may be identified as another group, such thatcodeword with respect to a distance index may be allocated to each groupby using different binarizations. According to each precision group,codeword of a distance index may be determined by using FLC or may bedetermined by using VLC including T-unary coding. FIG. 32 illustratescodewords for respective distance indices in an embodiment in which 8distance offsets exist, and FIG. 33 illustrates codewords for respectivedistance indices in an embodiment in which 6 distance offsets exist.

Binarizations as in FIGS. 32 and 33 may be effective in a case where aprobability that a distance offset of actual sub-pixel precision occursis higher than a probability that a distance offset of precision in aninteger pixel unit occurs. In particular, a probability of 0 in aprecision flag is increased to improve entropy encoding efficiency, suchthat a bit amount may be decreased.

In codeword expression methods according to FIGS. 32 and 33 , aprecision flag and an index in each precision may be respectivelyexpressed as syntax elements. Different binarizations may be applied insame syntax element, according to bits.

Hereinafter, an embodiment will now be described, in which the videodecoding apparatus 1700 and the video encoding apparatus 1900 apply atriangular partition prediction mode and an intra/inter combinationprediction mode.

According to the triangular partition prediction mode, a current blockmay be split into two triangular partition shapes along a diagonal lineconnecting opposite vertexes of a square block, and prediction may beperformed on each of the triangular partitions. According to thisprediction technique, an area where prediction blocks of the twotriangular partitions contact is filled with a prediction value obtainedby performing filtering on the prediction blocks of the two triangularpartitions, such that a new square prediction block is generated.

FIG. 34 illustrates triangular partitions that are available in atriangular partition prediction mode according to an embodiment.

Triangular partitions PU1 and PU2 may be determined by connecting atop-left vertex and a bottom-right vertex of a current block 3400 whichface each other. Triangular partitions PU1 and PU2 may be determined byconnecting a top-right vertex and a bottom-left vertex of a currentblock 3410 which face each other.

The current blocks 3400 and 3410 may be coding units.

Different motion vectors may be determined for triangular partitionsaccording to prediction using two triangular partitions, and informationabout a motion vector may be signaled between the video encodingapparatus 1900 and the video decoding apparatus 1700.

FIG. 35 illustrates a prediction block determined by using triangularpartitions in a triangular partition prediction mode according to anembodiment.

A size of a prediction block 3500 may be 8×8, and triangular partitionprediction blocks may be generated in a triangular partition mode. Byperforming filtering on prediction values P1 and P2 of the triangularpartition prediction blocks, a final prediction value of an intermediatearea where the triangular partition prediction blocks contact each othermay be determined. A filtering weight may be determined in inverseproportion to a distance from a prediction block area to a triangularpartition prediction block.

For example, N that is a number marked on every pixel of theintermediate area of the prediction block 3500 indicates a filteringweight. When N is 7, a filtering weight of ⅞ may be allocated to P1(⅞*P1) that is a prediction value of a close prediction block from amongthe triangular partition prediction blocks, a filtering weight of 8−7=1may be allocated to P2 (⅛*P2) that is a prediction value of a distantprediction block, and then a weighted sum of results thereof may bedetermined to be a final prediction value (⅞*P1+⅛*P2). When N is 6, afiltering weight of 6/8 may be allocated to P1 ( 6/8*P1) that is aprediction value of a close prediction block from among the triangularpartition prediction blocks, a filtering weight of 8−6=2 may beallocated to P2 ( 2/8*P2) that is a prediction value of a distantprediction block, and then a weighted sum of results thereof may bedetermined to be a final prediction value ( 6/8*P1+ 2/8*P2).

In a case where a size of a prediction block 3510 is 4*4, when N is 7, afiltering weight of ⅞ may be allocated to P1 (⅞*P1) that is a predictionvalue of a close prediction block from among triangular partitionprediction blocks, a filtering weight of 8−7=1 may be allocated to P2(⅛*P2) that is a prediction value of a distant prediction block, andthen a weighted sum of results thereof may be determined to be a finalprediction value (⅞*P1+⅛*P2).

The triangular partition mode according to an embodiment may not be usedfor a coding unit having a small size, i.e., a case in whichmultiplication of a width and a height of the coding unit is smallerthan 64. This is because a split effect of a coding unit is decreasedwhen a small block is split into triangular partitions.

Also, when a triangular partition does not cover an object in a verylarge coding unit, a splitting method of a coding unit of quadtree orternary tree may be further efficient. Because overhead of a flag whichoccurs in the triangular partition mode is a load, and calculation oftriangular partition prediction increases complexity of an encoder, thetriangular partition mode may be inefficient for a coding unit having aparticular large size.

Therefore, the video decoding apparatus 1700 and the video encodingapparatus 1900 according to an embodiment may determine whether toperform the triangular partition mode according to conditions below.Here, MAX_CU_SIZE indicates a maximum size of a coding unit.

(width*height<64∥width>=MAX_CU_SIZE∥height>=MAX_CU_SIZE)  Condition 1:

That is, when multiplication of a size and a width of a current block issmaller than 64, the size of the current block is greater than a maximumsize of a coding unit, or the width of the current block is greater thanthe maximum size of the coding unit, the video decoding apparatus 1700and the video encoding apparatus 1900 according to an embodiment maydetermine that it is unavailable to apply the triangular partitionprediction mode to the current block.

According to Condition 1, application of the triangular partition modeis prevented with respect to an area for which predicted efficiency islow, such that complexity of an encoder may be decreased, signaling ofan unnecessary mode flag may be prevented, and thus encoding efficiencymay be improved.

As in Condition 2 below, threshold values of a height and a width of acoding unit may be modified to MAX_CU_SIZE/2.

(width*height<64∥width>=MAX_CU_SIZE/2∥height>=MAX_CU_SIZE/2)  Condition2:

The video decoding apparatus 1700 and the video encoding apparatus 1900according to an embodiment may determine a prediction block through anintra/inter combination mode.

The intra/inter combination mode (or a multi-hypothesis mode) refers toa technology by which a current block is predicted in each of an intraprediction mode and an inter prediction mode so as to generaterespective prediction blocks, and two prediction blocks areweight-averaged to generate a new prediction block.

Syntax elements respectively required for the intra prediction mode andthe inter prediction mode are transmitted to the video decodingapparatus 1700 to perform intra prediction and inter prediction.

The video encoding apparatus 1900 may transmit, in the form of a mergeindex, a syntax element related to the inter prediction mode, and thevideo decoding apparatus 1700 may reconstruct a motion vector and areference picture.

A syntax element related to the intra prediction mode may include intraprediction direction information indicating one of 4 modes (DC, planar,horizontal, and vertical modes).

The intra/inter combination mode according to an embodiment may not beused for a coding unit having a small size, i.e., a case in whichmultiplication of a width and a height of the coding unit is smallerthan 64. This is because a load of calculations occurring in acombination calculation of intra prediction and inter prediction isgreater than a split effect of a coding unit.

Therefore, the video decoding apparatus 1700 and the video encodingapparatus 1900 according to an embodiment may determine whether toperform the triangular partition mode according to conditions below.Here, MAX_CU_SIZE indicates a maximum size of a coding unit.

(width*height<64∥width>=MAX_CU_SIZE∥height>=MAX_CU_SIZE)  Condition 1:

That is, when multiplication of a size and a width of a current block issmaller than 64, the size of the current block is greater than a maximumsize of a coding unit, or the width of the current block is greater thanthe maximum size of the coding unit, the video decoding apparatus 1700and the video encoding apparatus 1900 according to an embodiment maydetermine that it is unavailable to apply the intra/inter combinationmode to the current block.

According to Condition 1, application of the triangular partition modeis prevented with respect to an area for which predicted efficiency islow, such that complexity of an encoder may be decreased, signaling ofan unnecessary mode flag may be prevented, and thus encoding efficiencymay be improved.

As in Condition 2 below, threshold values of a height and a width of acoding unit may be modified to MAX_CU_SIZE/2.

(width*height<64∥width>=MAX_CU_SIZE/2∥height>=MAX_CU_SIZE/2)  Condition2:

Also, when the triangular partition prediction mode is enabled, thevideo decoding apparatus 1700 according to an embodiment may determinewhether an intra/inter combination prediction mode is enabled.

The syntax element obtainer 1710 according to an embodiment may obtain,from a bitstream, sequence MMVD information indicating whether thetriangular partition prediction mode is enabled to the current block.Also, the syntax element obtainer 1710 may obtain, from the bitstream,second information indicating whether the intra/inter combinationprediction mode is enabled to the current block.

When the triangular partition prediction mode is enabled to the currentblock according to the sequence MMVD information, the decoder 1720according to an embodiment may determine whether to apply the triangularpartition prediction mode to the current block, based on a size and awidth of the current block. When multiplication of the size and thewidth of the current block is smaller than 64, the size of the currentblock is greater than a maximum size of a coding unit, or the width ofthe current block is greater than the maximum size of the coding unit,it may be determined that it is unavailable to apply the triangularpartition prediction mode to the current block.

When the triangular partition prediction mode is enabled for the currentblock according to the sequence MMVD information, and the intra/intercombination prediction mode is enabled for the current block accordingto the second information, the decoder 1720 according to an embodimentmay determine whether to apply the intra/inter combination predictionmode to the current block, based on the size and the width of thecurrent block. When multiplication of the size and the width of thecurrent block is smaller than 64, the size of the current block isgreater than the maximum size of the coding unit, or the width of thecurrent block is greater than the maximum size of the coding unit, itmay be determined that it is unavailable to apply the intra/intercombination prediction mode to the current block.

In particular, when the triangular partition prediction mode is enabled,the intra/inter combination prediction mode is enabled, multiplicationof the size and the width of the current block is equal to or greaterthan 64, the size of the current block is equal to or smaller than themaximum size of the coding unit, or the width of the current block isequal to or smaller than the maximum size of the coding unit, thedecoder 1720 may apply the intra/inter combination prediction mode tothe current block.

Similarly, when the triangular partition prediction mode is enabled, thevideo encoding apparatus 1900 according to an embodiment may determinewhether the intra/inter combination prediction mode is enabled.

When the triangular partition prediction mode is enabled for a currentblock, the inter prediction performer 1910 according to an embodimentmay determine whether to apply the triangular partition prediction modeto the current block, based on a size and a width of the current block.When multiplication of the size and the width of the current block issmaller than 64, the size of the current block is greater than a maximumsize of a coding unit, or the width of the current block is greater thanthe maximum size of the coding unit, it may be determined that it isunavailable to apply the triangular partition prediction mode to thecurrent block.

When the triangular partition prediction mode is enabled for the currentblock, and the intra/inter combination prediction mode is enabled forthe current block according to the second information, the interprediction performer 1910 according to an embodiment may determinewhether to apply the intra/inter combination prediction mode to thecurrent block, based on the size and the width of the current block.When multiplication of the size and the width of the current block issmaller than 64, the size of the current block is greater than themaximum size of the coding unit, or the width of the current block isgreater than the maximum size of the coding unit, it may be determinedthat it is unavailable to apply the intra/inter combination predictionmode to the current block.

The syntax element encoder 1920 according to an embodiment may encodesequence MMVD information indicating whether the triangular partitionprediction mode is enabled for the current block. Also, the syntaxelement encoder 1920 may encode second information indicating whetherthe intra/inter combination prediction mode is enabled for the currentblock.

In particular, when the triangular partition prediction mode is enabled,the intra/inter combination prediction mode is enabled, multiplicationof the size and the width of the current block is equal to or greaterthan 64, the size of the current block is equal to or smaller than themaximum size of the coding unit, or the width of the current block isequal to or smaller than the maximum size of the coding unit, the interprediction performer 1910 may apply the intra/inter combinationprediction mode to the current block.

Meanwhile, the embodiments of the disclosure may be written as programsthat are executable on a computer, and the programs may be stored in amedium.

The medium may continuously store the computer-executable programs ormay temporarily store the computer-executable programs for execution ordownloading. Also, the medium may be any one of various recording mediaor storage media in which a single piece or plurality of pieces ofhardware are combined, and the medium is not limited to those directlyconnected to a certain computer system, but may be distributed over anetwork. Examples of the medium include magnetic media such as a harddisk, a floppy disk, and a magnetic tape, optical recording media suchas compact disc-read only memory (CD-ROM) and a digital versatile disc(DVD), magneto-optical media such as floptical disk, read only memory(ROM), random access memory (RAM), a flash memory, etc., which areconfigured to store program instructions. Also, other examples of themedium include recording media and storage media managed by applicationstores distributing applications or by websites, servers, and the likesupplying or distributing other various types of software.

While one or more embodiments of the disclosure are described in detailwith reference to exemplary embodiments above, it will be understood byone of ordinary skill in the art that the disclosure is not limited tothe embodiments, and various changes in form and details may be madetherein without departing from the spirit and scope of the disclosure.

1. A video decoding method comprising: obtaining, from a sequenceparameter set (SPS), sequence merge mode with a motion vector difference(MMVD) information indicating whether an MMVD mode is enabled for acurrent sequence; when the MMVD mode is enabled for the current sequenceaccording to the sequence MMVD information, obtaining, from a bitstream,MMVD information indicating whether the MMVD mode is used in an interprediction mode for a current block comprised in the current sequence;when the MMVD mode is used for the current block in the inter predictionmode according to the MMVD information, obtaining a first bin of adistance index of a merge motion vector difference by performing entropydecoding using context information on the bitstream, and obtaining otherbins of the distance index of the merge motion vector difference byperforming entropy decoding in a bypass mode on the bitstream; obtainingthe distance index of the merge motion vector difference correspondingto the first bin and the other bins of the distance index of the mergemotion vector difference, according to a truncated Rice (TR)binarization method; obtaining bins indicating a direction index of themerge motion vector difference by performing entropy decoding on thebitstream in the bypass mode; obtaining the direction index of the mergemotion vector difference corresponding to the bins indicating thedirection index of the merge motion vector difference, according to afixed-length (FL) binarization method; reconstructing a motion vector ofthe current block based on the merge motion vector difference determinedusing the distance index of the merge motion vector difference and thedirection index of the merge motion vector difference; andreconstructing the current block by using the motion vector of thecurrent block.
 2. A video decoding apparatus comprising: a syntaxelement obtainer configured to obtain, from a sequence parameter set(SPS), sequence merge mode with a motion vector difference (MMVD)information indicating whether an MMVD mode is enabled for a currentsequence, and when the MMVD mode is enabled for the current sequenceaccording to the sequence MMVD information, obtain, from a bitstream,MMVD information indicating whether the MMVD mode is applied in an interprediction mode for a current block comprised in the current sequence;and a decoder configured to, when the MMVD mode is used for the currentblock in the inter prediction mode according to the MMVD information,obtain a first bin of a distance index of a merge motion vectordifference by performing entropy decoding using context information onthe bitstream, and obtain other bins of the distance index of the mergemotion vector difference by performing entropy decoding in a bypass modeon the bitstream, obtain the distance index of the merge motion vectordifference corresponding to the first bin and the other bins of thedistance index of the merge motion vector difference, according to atruncated Rice (TR) binarization method, obtain bins indicating adirection index of the merge motion vector difference by performingentropy decoding on the bitstream in the bypass mode, and obtain thedirection index of the merge motion vector difference corresponding tothe bins indicating the direction index of the merge motion vectordifference, according to a fixed-length (FL) binarization method, andreconstruct a motion vector of the current block based on the mergemotion vector difference determined using the distance index of themerge motion vector difference and the direction index of the mergemotion vector difference, and reconstruct the current block by using themotion vector of the current block.
 3. A video encoding methodcomprising: encoding, into a sequence parameter set (SPS), sequencemerge mode with a motion vector difference (MMVD) information indicatingwhether an MMVD mode is enabled for a current sequence; when the MMVDmode is enabled for the current sequence, encoding MMVD informationindicating whether the MMVD mode is used for a current block comprisedin the current sequence in an inter prediction mode; and when the MMVDmode is used for the current block in the inter prediction mode,obtaining bins of a distance index of a merge motion vector differencecorresponding to the distance index of the merge motion vectordifference according to a truncated Rice (TR) binarization method,performing, using context information, entropy encoding on a first binamong the bins of the distance index of the merge motion vectordifference into a bitstream and performing, by in a bypass mode, entropyencoding on other bins among the bins of the distance index of the mergemotion vector difference into the bitstream, obtaining bins of adirection index of the merge motion vector difference corresponding tothe direction index of the merge motion vector difference according to afixed-length (FL) binarization method, and performing, by in the bypassmode, entropy encoding on the bins indicating the direction index of themerge motion vector difference of the current block into the bitstream.4. A non-transitory computer readable storage medium storing a bitstreamgenerated by a video encoding method, the bitstream comprising: sequencemerge mode with a motion vector difference (MMVD) information indicatingwhether an MMVD mode is enabled for a current sequence; MMVD informationindicating whether the MMVD mode is used for a current block comprisedin the current sequence in an inter prediction mode; information aboutdistance index of a merge motion vector difference; and informationabout direction index of the merge motion vector difference, wherein thevideo encoding method comprises: encoding, into a sequence parameter set(SPS), the sequence MMVD information for the current sequence; when theMMVD mode is enabled for the current sequence, encoding the MMVDinformation indicating whether the MMVD mode is used for the currentblock in the inter prediction mode; and when the MMVD mode is used forthe current block in the inter prediction mode, obtaining bins of thedistance index of the merge motion vector difference corresponding tothe distance index of the merge motion vector difference according to atruncated Rice (TR) binarization method, performing, using contextinformation, entropy encoding on a first bin among the bins of thedistance index of the merge motion vector difference into theinformation about the distance index of the merge motion vectordifference, and performing, by in a bypass mode, entropy encoding onother bins among the bins of the distance index of the merge motionvector difference into the information about the distance index of themerge motion vector difference, obtaining bins of the direction index ofthe merge motion vector difference corresponding to the direction indexof the merge motion vector difference according to a fixed-length (FL)binarization method, and performing, by in the bypass mode, entropyencoding on the bins indicating the direction index of the merge motionvector difference of the current block into the information about thedirection index of the merge motion vector difference.